-
Notifications
You must be signed in to change notification settings - Fork 16
Queue.pause
Parameter: global
Boolean
-
true
for a global queue pause,false
orundefined
to only pause the local Queue object.
Returns: Promise
=> true
- Will only ever resolve to
true
.
Example:
q.pause().then(() => {
// The Queue object is now paused
}).catch(err => console.error(err))
Use the Queue.pause
method for pausing either the entire queue or just the local Queue object. After calling Queue.pause
your code will wait until all running jobs being processed by the local Queue object have finished before resolving the Promise. This could take some time depending on your jobs.
To globally pause the queue, pass the global
parameter as true
. This will cause the Queue object to write a state document to the queue database table causing a change feed to be sent to all Queue objects connected to the same queue. Once a Queue object receives this global pause event it will transition to a pause state. Again, each Queue objects will remain in a pausing
state until all running jobs have completed.
To resume the Queue objects call the Queue.resume method.
Warning: It is possible for you to send a global pause causing all Queue objects to enter a pause state, and then only resume the local Queue object.
If you are wanting to stop the queue gracefully, try Queue.stop instead of Queue.pause
.
- Introduction
- Tutorial
- Queue Constructor
- Queue Connection
- Queue Options
- Queue PubSub
- Queue Master
- Queue Events
- State Document
- Job Processing
- Job Options
- Job Status
- Job Retry
- Job Repeat
- Job Logging
- Job Editing
- Job Schema
- Job Name
- Complex Job
- Delayed Job
- Cancel Job
- Error Handling
- Queue.createJob
- Queue.addJob
- Queue.getJob
- Queue.findJob
- Queue.findJobByName
- Queue.containsJobByName
- Queue.cancelJob
- Queue.reanimateJob
- Queue.removeJob
- Queue.process
- Queue.review
- Queue.summary
- Queue.ready
- Queue.pause
- Queue.resume
- Queue.reset
- Queue.stop
- Queue.drop
- Queue.Job
- Queue.host
- Queue.port
- Queue.db
- Queue.name
- Queue.r
- Queue.id
- Queue.jobOptions [R/W]
- Queue.changeFeed
- Queue.master
- Queue.masterInterval
- Queue.removeFinishedJobs
- Queue.running
- Queue.concurrency [R/W]
- Queue.paused
- Queue.idle
- Event.ready
- Event.added
- Event.updated
- Event.active
- Event.processing
- Event.progress
- Event.log
- Event.pausing
- Event.paused
- Event.resumed
- Event.completed
- Event.cancelled
- Event.failed
- Event.terminated
- Event.reanimated
- Event.removed
- Event.idle
- Event.reset
- Event.error
- Event.reviewed
- Event.detached
- Event.stopping
- Event.stopped
- Event.dropped
- Job.setName
- Job.setPriority
- Job.setTimeout
- Job.setDateEnable
- Job.setRetryMax
- Job.setRetryDelay
- Job.setRepeat
- Job.setRepeatDelay
- Job.updateProgress
- Job.update
- Job.getCleanCopy
- Job.addLog
- Job.getLastLog