bull队列提供了 pause/resume 方法来暂停/恢复job的执行,同时它们又分成了 local/global两种
如果是local的pause,只是设置一个 this.paused 的 Promise,然后调用 resumeLocal 恢复
doNotWaitActive 则代表停滞 bclient 的 block 操作,不要再等待 wait to active 队列的 job
Queue.prototype.pause = function(isLocal, doNotWaitActive) {
return this.isReady()
.then(() => {
if (isLocal) {
if (!this.paused) {
this.paused = new Promise(resolve => {
this.resumeLocal = function() {
this.paused = null; // Allow pause to be checked externally for paused state.
resolve();
};
});
}
if (!this.bclientInitialized) {
// bclient not yet ini