fix(stop): always update status to warning when stop is executed

This commit is contained in:
Nicolas Meienberger 2025-12-21 14:05:15 +01:00
parent fc04cfe02e
commit 97d0a86946

View file

@ -428,6 +428,7 @@ const stopBackup = async (scheduleId: number) => {
throw new NotFoundError("Backup schedule not found"); throw new NotFoundError("Backup schedule not found");
} }
try {
const abortController = runningBackups.get(scheduleId); const abortController = runningBackups.get(scheduleId);
if (!abortController) { if (!abortController) {
throw new ConflictError("No backup is currently running for this schedule"); throw new ConflictError("No backup is currently running for this schedule");
@ -436,7 +437,7 @@ const stopBackup = async (scheduleId: number) => {
logger.info(`Stopping backup for schedule ${scheduleId}`); logger.info(`Stopping backup for schedule ${scheduleId}`);
abortController.abort(); abortController.abort();
} finally {
await db await db
.update(backupSchedulesTable) .update(backupSchedulesTable)
.set({ .set({
@ -445,6 +446,7 @@ const stopBackup = async (scheduleId: number) => {
updatedAt: Date.now(), updatedAt: Date.now(),
}) })
.where(eq(backupSchedulesTable.id, scheduleId)); .where(eq(backupSchedulesTable.id, scheduleId));
}
}; };
const runForget = async (scheduleId: number, repositoryId?: string) => { const runForget = async (scheduleId: number, repositoryId?: string) => {