Restored to 'e1314807be287b395cffa7ada2c736a4a7831e11'
Replit-Restored-To: e1314807be
This commit is contained in:
+7
-8
@@ -116,21 +116,20 @@ class VideoSyncService {
|
||||
};
|
||||
|
||||
if (existingVideo.rows.length === 0) {
|
||||
// Insert new video using raw SQL with all required columns including the new ones
|
||||
// Insert new video using raw SQL to avoid schema issues
|
||||
await db.execute(sql`
|
||||
INSERT INTO videos (id, title, artist, description, filename, episode_number, episode_title, thumbnail_url, video_url, duration, views, category, custom_thumbnail_url, tags, is_public, content_type, genre, upload_status, created_at, updated_at)
|
||||
VALUES (${videoData.id}, ${videoData.title}, NULL, ${videoData.description}, ${videoData.title}, NULL, NULL, ${videoData.thumbnailUrl}, ${videoData.videoUrl}, ${videoData.duration}, ${videoData.views}, ${videoData.category}, ${videoData.customThumbnailUrl}, ${'{' + videoData.tags.join(',') + '}'}, ${videoData.isPublic}, 'video', 'other', 'completed', ${videoData.createdAt.toISOString()}, ${videoData.updatedAt.toISOString()})
|
||||
INSERT INTO videos (id, title, description, thumbnail_url, video_url, duration, views, category, custom_thumbnail_url, tags, is_public, created_at, updated_at)
|
||||
VALUES (${videoData.id}, ${videoData.title}, ${videoData.description}, ${videoData.thumbnailUrl}, ${videoData.videoUrl}, ${videoData.duration}, ${videoData.views}, ${videoData.category}, ${videoData.customThumbnailUrl}, ${'{' + videoData.tags.join(',') + '}'}, ${videoData.isPublic}, ${videoData.createdAt.toISOString()}, ${videoData.updatedAt.toISOString()})
|
||||
`);
|
||||
insertedCount++;
|
||||
} else {
|
||||
// Update existing video using raw SQL with all fields
|
||||
// Update existing video using raw SQL
|
||||
await db.execute(sql`
|
||||
UPDATE videos
|
||||
SET title = ${videoData.title}, description = ${videoData.description}, thumbnail_url = ${videoData.thumbnailUrl},
|
||||
video_url = ${videoData.videoUrl}, duration = ${videoData.duration}, views = ${videoData.views},
|
||||
category = ${videoData.category}, custom_thumbnail_url = ${videoData.customThumbnailUrl},
|
||||
tags = ${'{' + videoData.tags.join(',') + '}'}, is_public = ${videoData.isPublic}, updated_at = ${videoData.updatedAt.toISOString()},
|
||||
artist = NULL, filename = ${videoData.title}, episode_number = NULL, episode_title = NULL
|
||||
tags = ${'{' + videoData.tags.join(',') + '}'}, is_public = ${videoData.isPublic}, updated_at = ${videoData.updatedAt.toISOString()}
|
||||
WHERE id = ${video.id}
|
||||
`);
|
||||
updatedCount++;
|
||||
@@ -167,9 +166,9 @@ class VideoSyncService {
|
||||
try {
|
||||
await this.syncVideos();
|
||||
|
||||
// Add timeout protection for database sync - increased to 2 minutes for large datasets
|
||||
// Add timeout protection for database sync
|
||||
const syncTimeout = new Promise((_, reject) =>
|
||||
setTimeout(() => reject(new Error('Database sync timeout after 2 minutes')), 120000)
|
||||
setTimeout(() => reject(new Error('Database sync timeout after 30 seconds')), 30000)
|
||||
);
|
||||
|
||||
await Promise.race([
|
||||
|
||||
Reference in New Issue
Block a user