fix: did not release lock for dispatchArchiveSnapshots when quitting

This commit is contained in:
alikia2x (寒寒) 2025-04-14 00:28:45 +08:00
parent d0b7d93e5b
commit f1651fee30
Signed by: alikia2x
GPG Key ID: 56209E0CCD8420C6
2 changed files with 2 additions and 1 deletions

View File

@ -159,7 +159,7 @@ export const archiveSnapshotsWorker = async (_job: Job) => {
const now = Date.now(); const now = Date.now();
const lastSnapshotedAt = latestSnapshot?.time ?? now; const lastSnapshotedAt = latestSnapshot?.time ?? now;
const interval = 168; const interval = 168;
logger.log(`Scheduled archive snapshot for aid ${aid} in ${interval} hours.`, "mq"); logger.log(`Scheduled archive snapshot for aid ${aid} in ${interval} hours.`, "mq", "fn:archiveSnapshotsWorker");
const targetTime = lastSnapshotedAt + interval * HOUR; const targetTime = lastSnapshotedAt + interval * HOUR;
await scheduleSnapshot(client, aid, "archive", targetTime); await scheduleSnapshot(client, aid, "archive", targetTime);
if (now - startedAt > 250 * MINUTE) { if (now - startedAt > 250 * MINUTE) {

View File

@ -99,4 +99,5 @@ snapshotWorker.on("error", (err) => {
snapshotWorker.on("closed", async () => { snapshotWorker.on("closed", async () => {
await lockManager.releaseLock("dispatchRegularSnapshots"); await lockManager.releaseLock("dispatchRegularSnapshots");
await lockManager.releaseLock("dispatchArchiveSnapshots");
}); });