Fix DB migration from 8.19 to 8.20 is in a loop.

Thanks to MaccabeeY and xet7 !

Fixes #6072
This commit is contained in:
Lauri Ojansivu 2026-01-18 20:27:23 +02:00
parent a787bcddf3
commit 2fa490d83d

View file

@ -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];