fix(backups): re-calculate next backup date before starting the backup

This commit is contained in:
Nicolas Meienberger
2025-11-15 11:13:23 +01:00
parent d78b4adfd9
commit b83881c189
2 changed files with 3 additions and 2 deletions

View File

@@ -195,9 +195,11 @@ const executeBackup = async (scheduleId: number, manual = false) => {
repositoryName: repository.name,
});
const nextBackupAt = calculateNextRun(schedule.cronExpression);
await db
.update(backupSchedulesTable)
.set({ lastBackupStatus: "in_progress", updatedAt: Date.now(), lastBackupError: null })
.set({ lastBackupStatus: "in_progress", updatedAt: Date.now(), lastBackupError: null, nextBackupAt })
.where(eq(backupSchedulesTable.id, scheduleId));
const abortController = new AbortController();

View File

@@ -7,7 +7,6 @@ import { repositoriesTable } from "../../db/schema";
import { toMessage } from "../../utils/errors";
import { restic } from "../../utils/restic";
import { cryptoUtils } from "../../utils/crypto";
import { logger } from "../../utils/logger";
import type { CompressionMode, RepositoryConfig } from "~/schemas/restic";
const listRepositories = async () => {