Update
This commit is contained in:
@ -86,6 +86,31 @@ 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