fix: did not release lock for dispatchArchiveSnapshots when quitting
This commit is contained in:
parent
d0b7d93e5b
commit
f1651fee30
@ -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) {
|
||||||
|
@ -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");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user