fix: automatically put in_progress backups to warning during startup
This commit is contained in:
parent
97d0a86946
commit
a32e49c4cf
2 changed files with 15 additions and 2 deletions
|
|
@ -181,7 +181,8 @@ export const ScheduleSummary = (props: Props) => {
|
||||||
<div className="md:col-span-2 lg:col-span-4">
|
<div className="md:col-span-2 lg:col-span-4">
|
||||||
<p className="text-xs uppercase text-muted-foreground">Warning Details</p>
|
<p className="text-xs uppercase text-muted-foreground">Warning Details</p>
|
||||||
<p className="font-mono text-sm text-yellow-600 whitespace-pre-wrap break-all">
|
<p className="font-mono text-sm text-yellow-600 whitespace-pre-wrap break-all">
|
||||||
Last backup completed with warnings. Check your container logs for more details.
|
{schedule.lastBackupError ??
|
||||||
|
"Last backup completed with warnings. Check your container logs for more details."}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { Scheduler } from "../../core/scheduler";
|
import { Scheduler } from "../../core/scheduler";
|
||||||
import { and, eq, or } from "drizzle-orm";
|
import { and, eq, or } from "drizzle-orm";
|
||||||
import { db } from "../../db/db";
|
import { db } from "../../db/db";
|
||||||
import { volumesTable } from "../../db/schema";
|
import { backupSchedulesTable, volumesTable } from "../../db/schema";
|
||||||
import { logger } from "../../utils/logger";
|
import { logger } from "../../utils/logger";
|
||||||
import { restic } from "../../utils/restic";
|
import { restic } from "../../utils/restic";
|
||||||
import { volumeService } from "../volumes/volume.service";
|
import { volumeService } from "../volumes/volume.service";
|
||||||
|
|
@ -63,6 +63,18 @@ export const startup = async () => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await db
|
||||||
|
.update(backupSchedulesTable)
|
||||||
|
.set({
|
||||||
|
lastBackupStatus: "warning",
|
||||||
|
lastBackupError: "Zerobyte was restarted during the last scheduled backup",
|
||||||
|
updatedAt: Date.now(),
|
||||||
|
})
|
||||||
|
.where(eq(backupSchedulesTable.lastBackupStatus, "in_progress"))
|
||||||
|
.catch((err) => {
|
||||||
|
logger.error(`Failed to update stuck backup schedules on startup: ${err.message}`);
|
||||||
|
});
|
||||||
|
|
||||||
Scheduler.build(CleanupDanglingMountsJob).schedule("0 * * * *");
|
Scheduler.build(CleanupDanglingMountsJob).schedule("0 * * * *");
|
||||||
Scheduler.build(VolumeHealthCheckJob).schedule("*/30 * * * *");
|
Scheduler.build(VolumeHealthCheckJob).schedule("*/30 * * * *");
|
||||||
Scheduler.build(RepositoryHealthCheckJob).schedule("50 12 * * *");
|
Scheduler.build(RepositoryHealthCheckJob).schedule("50 12 * * *");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue