Update
This commit is contained in:
@ -18,6 +18,7 @@ class BatchScheduler {
|
||||
};
|
||||
|
||||
private currentAbortController?: AbortController;
|
||||
private migrationCompleted = false;
|
||||
|
||||
private readonly SIX_HOURS_MS = 6 * 60 * 60 * 1000; // 6 hours in milliseconds
|
||||
|
||||
@ -84,6 +85,28 @@ class BatchScheduler {
|
||||
|
||||
try {
|
||||
console.log("🔄 Running scheduled batch process...");
|
||||
|
||||
// Run migration for feeds without categories (only once)
|
||||
if (!this.migrationCompleted) {
|
||||
try {
|
||||
const { migrateFeedsWithCategories, getFeedCategoryMigrationStatus } = await import("./database.js");
|
||||
const migrationStatus = await getFeedCategoryMigrationStatus();
|
||||
|
||||
if (!migrationStatus.migrationComplete) {
|
||||
console.log("🔄 Running feed category migration...");
|
||||
await migrateFeedsWithCategories();
|
||||
this.migrationCompleted = true;
|
||||
} else {
|
||||
console.log("✅ Feed category migration already complete");
|
||||
this.migrationCompleted = true;
|
||||
}
|
||||
} catch (migrationError) {
|
||||
console.error("❌ Error during feed category migration:", migrationError);
|
||||
// Don't fail the entire batch process due to migration error
|
||||
this.migrationCompleted = true; // Mark as completed to avoid retrying every batch
|
||||
}
|
||||
}
|
||||
|
||||
await batchProcess(this.currentAbortController.signal);
|
||||
console.log("✅ Scheduled batch process completed");
|
||||
} catch (error) {
|
||||
|
Reference in New Issue
Block a user