node-resque
Version:
an opinionated implementation of resque in node
26 lines (25 loc) • 712 B
JavaScript
;
// If a job with the same name, queue, and args is already in the delayed queue(s), do not enqueue it again
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("./../index");
class DelayQueueLock extends index_1.Plugin {
async beforeEnqueue() {
const timestamps = await this.queueObject.scheduledAt(this.queue, this.func, this.args);
if (timestamps.length > 0) {
return false;
}
else {
return true;
}
}
afterEnqueue() {
return true;
}
beforePerform() {
return true;
}
afterPerform() {
return true;
}
}
exports.DelayQueueLock = DelayQueueLock;