This commit is contained in:
2025-06-08 18:32:42 +09:00
parent 5255ced0a0
commit dc01ac4380
2 changed files with 37 additions and 4 deletions

View File

@ -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) {