fix: did not quit when job is already workingx
This commit is contained in:
parent
723b6090c4
commit
0455abce2e
@ -133,7 +133,11 @@ export const collectMilestoneSnapshotsWorker = async (_job: Job) => {
|
|||||||
export const regularSnapshotsWorker = async (_job: Job) => {
|
export const regularSnapshotsWorker = async (_job: Job) => {
|
||||||
const client = await db.connect();
|
const client = await db.connect();
|
||||||
const startedAt = Date.now();
|
const startedAt = Date.now();
|
||||||
await lockManager.acquireLock("dispatchRegularSnapshots");
|
if (await lockManager.isLocked("dispatchRegularSnapshots")) {
|
||||||
|
logger.log("dispatchRegularSnapshots is already running", "mq");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await lockManager.acquireLock("dispatchRegularSnapshots", 30 * 60);
|
||||||
try {
|
try {
|
||||||
const aids = await getVideosWithoutActiveSnapshotSchedule(client);
|
const aids = await getVideosWithoutActiveSnapshotSchedule(client);
|
||||||
for (const rawAid of aids) {
|
for (const rawAid of aids) {
|
||||||
|
Loading…
Reference in New Issue
Block a user