-
Notifications
You must be signed in to change notification settings - Fork 16
Queue.jobOptions
Grant Carthew edited this page Oct 1, 2016
·
8 revisions
Set: Object
- A valid Job Options object to change the job default options for the Queue object.
Get: Object
- The currently configured default job options for the Queue object.
Example:
const Queue = require('rethinkdb-job-queue')
const q = new Queue()
let originalOptions = q.jobOptions
// originalOptions will be as follows
// { priority: 'normal', timeout: 300000, retryMax: 3, retryDelay: 600000 }
q.jobOptions = { timeout: 400000 }
let newOptions = q.jobOptions
// newOptions will be as follows
// { priority: 'normal', timeout: 400000, retryMax: 3, retryDelay: 600000 }
The Queue object jobOptions
property is used to define the default options for new jobs created with Queue.createJob. You do not need to change the default job options using this property. Only use it if you are not happy with the builtin defaults.
See the Job Options document for a description of the available job options and their default values.
This example creates two jobs called job1 and job2 after changing the jobOptions
property. After creating the jobs, job1 will have the new default options while job2 will have a different timeout
value.
const Queue = require('rethinkdb-job-queue')
const q = new Queue()
const options = {
priority: 'low',
timeout: 200000,
retryMax: 2,
retryDelay: 0
}
let originalOptions = q.jobOptions
// originalOptions will be as follows
// { priority: 'normal', timeout: 300000, retryMax: 3, retryDelay: 600000 }
// Setting the new job default options
q.jobOptions = options
let job1 = q.createJob()
// This job1 object will have the new default options above
let job2 = q.createJob({ timeout: 400000 })
// This job2 object will have the new defaults except for the timeout value of 400000
// Now add the jobs to the Queue
q.addJob([job1, job2]).catch(err => console.error(err))
- 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