Skip to content

Commit

Permalink
fix: added lock bind on cleanup-sqlite job
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed May 8, 2024
1 parent 8931158 commit 7750ad2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions jobs/cleanup-sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const { parentPort } = require('node:worker_threads');
require('#config/mongoose');

const Graceful = require('@ladjs/graceful');
const Lock = require('ioredfour');
const Redis = require('@ladjs/redis');
const _ = require('lodash');
const dayjs = require('dayjs-with-plugins');
Expand Down Expand Up @@ -48,6 +49,12 @@ const graceful = new Graceful({
logger
});

// bind in order for locking to work
wsp.lock = new Lock({
redis: client,
namespace: config.imapLockNamespace
});

// store boolean if the job is cancelled
let isCancelled = false;

Expand Down

0 comments on commit 7750ad2

Please sign in to comment.