Prioritize database updates for videos over Bunny cache

Update video metadata in PostgreSQL and invalidate Bunny.net cache to ensure data consistency.

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/d05DGZF
This commit is contained in:
sebastjanartic 2025-09-02 15:04:37 +00:00
parent dec09b7b2f
commit fef1b66bd7

View File

@ -1044,7 +1044,16 @@ export class HybridStorage implements IStorage {
}
async updateVideo(id: string, video: UpdateVideo): Promise<Video | undefined> {
return this.bunnyStorage.updateVideo(id, video);
// Save changes to PostgreSQL database instead of Bunny cache
const result = await this.databaseStorage.updateVideo(id, video);
// Also invalidate Bunny cache so changes are reflected immediately
const bunnyVideo = await this.bunnyStorage.getVideo(id);
if (bunnyVideo) {
await this.bunnyStorage.updateVideo(id, video);
}
return result;
}
async updateVideoViews(id: string): Promise<void> {