Update category management and RSS endpoint handling
This commit is contained in:
@ -86,24 +86,39 @@ class BatchScheduler {
|
||||
try {
|
||||
console.log("🔄 Running scheduled batch process...");
|
||||
|
||||
// Run migration for feeds without categories (only once)
|
||||
// Run migrations (only once per startup)
|
||||
if (!this.migrationCompleted) {
|
||||
try {
|
||||
// Feed category migration
|
||||
const { migrateFeedsWithCategories, getFeedCategoryMigrationStatus } =
|
||||
await import("./database.js");
|
||||
const migrationStatus = await getFeedCategoryMigrationStatus();
|
||||
const feedMigrationStatus = await getFeedCategoryMigrationStatus();
|
||||
|
||||
if (!migrationStatus.migrationComplete) {
|
||||
if (!feedMigrationStatus.migrationComplete) {
|
||||
console.log("🔄 Running feed category migration...");
|
||||
await migrateFeedsWithCategories();
|
||||
this.migrationCompleted = true;
|
||||
console.log("✅ Feed category migration completed");
|
||||
} else {
|
||||
console.log("✅ Feed category migration already complete");
|
||||
this.migrationCompleted = true;
|
||||
}
|
||||
|
||||
// Episode category migration
|
||||
const { migrateEpisodesWithCategories, getEpisodeCategoryMigrationStatus } =
|
||||
await import("./database.js");
|
||||
const episodeMigrationStatus = await getEpisodeCategoryMigrationStatus();
|
||||
|
||||
if (!episodeMigrationStatus.migrationComplete) {
|
||||
console.log("🔄 Running episode category migration...");
|
||||
await migrateEpisodesWithCategories();
|
||||
console.log("✅ Episode category migration completed");
|
||||
} else {
|
||||
console.log("✅ Episode category migration already complete");
|
||||
}
|
||||
|
||||
this.migrationCompleted = true;
|
||||
} catch (migrationError) {
|
||||
console.error(
|
||||
"❌ Error during feed category migration:",
|
||||
"❌ Error during category migrations:",
|
||||
migrationError,
|
||||
);
|
||||
// Don't fail the entire batch process due to migration error
|
||||
|
Reference in New Issue
Block a user