Update video information and refresh cached content
Update video record in the database with new information and a timestamp. If the database update is successful, invalidate the cache to ensure the latest video data is loaded. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2cd2c0bc-434c-4bc9-ad3f-b99d3897a0d1/n7jzC7R
This commit is contained in:
parent
5fb9842ad0
commit
246ddc7160
@ -850,12 +850,27 @@ class BunnyStorage implements IStorage {
|
||||
|
||||
try {
|
||||
// Try to update in database first
|
||||
let dbUpdateSuccessful = false;
|
||||
try {
|
||||
await db.update(videos).set(updates as UpdateVideo).where(eq(videos.id, id));
|
||||
await db.update(videos).set({...updates, updatedAt: new Date()}).where(eq(videos.id, id));
|
||||
console.log(`Successfully updated video ${id} in database`);
|
||||
dbUpdateSuccessful = true;
|
||||
} catch (dbError) {
|
||||
console.warn(`Database update failed for video ${id}, using cache:`, dbError);
|
||||
}
|
||||
|
||||
// If database update was successful, invalidate cache to refresh with updated data
|
||||
if (dbUpdateSuccessful) {
|
||||
try {
|
||||
const { videoSyncService } = await import('./videoSync');
|
||||
console.log(`Invalidating cache for updated video ${id}...`);
|
||||
await videoSyncService.initialize();
|
||||
console.log(`Cache invalidated after updating video ${id}`);
|
||||
} catch (syncError) {
|
||||
console.warn('Failed to invalidate cache after video update:', syncError);
|
||||
}
|
||||
}
|
||||
|
||||
// Update face detection data in cache if present
|
||||
const faceFields = ['faceCenterPosition', 'facesDetected', 'faceConfidence'];
|
||||
const faceData = Object.fromEntries(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user