From 2fa490d83da858b193ca6a363e1599c5bbe55640 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sun, 18 Jan 2026 20:27:23 +0200 Subject: [PATCH] Fix DB migration from 8.19 to 8.20 is in a loop. Thanks to MaccabeeY and xet7 ! Fixes #6072 --- server/cronMigrationManager.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/server/cronMigrationManager.js b/server/cronMigrationManager.js index c509a396a..9b0b7faab 100644 --- a/server/cronMigrationManager.js +++ b/server/cronMigrationManager.js @@ -645,6 +645,11 @@ class CronMigrationManager { */ async runMigrationStep(step) { try { + // Check if already completed + if (step.completed) { + return; // Skip if already completed + } + // Starting migration step cronMigrationCurrentStep.set(step.name); @@ -666,6 +671,9 @@ class CronMigrationManager { step.progress = 100; step.status = 'completed'; + // Remove the cron job to prevent re-running every minute + SyncedCron.remove(step.cronName); + // Completed migration step // Update progress @@ -692,6 +700,15 @@ class CronMigrationManager { this.startTime = Date.now(); try { + // Remove cron jobs to prevent conflicts with job queue + this.migrationSteps.forEach(step => { + try { + SyncedCron.remove(step.cronName); + } catch (error) { + // Ignore errors if cron job doesn't exist + } + }); + // Add all migration steps to the job queue for (let i = 0; i < this.migrationSteps.length; i++) { const step = this.migrationSteps[i];