-
Notifications
You must be signed in to change notification settings - Fork 16
Job.getCleanCopy
Parameter: priorityAsString Boolean OPTIONAL
- Returns the priority value as a string if set to
true.
Returns: Object
- Holds a copy of the jobs properties.
Example:
let jobData = job.getCleanCopy()
// jobData.priority will be a number.This method is mostly used within the rethinkdb-job-queue to save the jobs to the database. You can use this method if you want a copy of the job properties.
The returned job object has all methods and the reference to the owning Queue object removed leaving only the job properties.
If you pass in a boolean true to the priorityAsString parameter, the returned object will have its priority value set as a string. If you don't need a string value for priority then leave this parameter out or set it to false. See the Job Options document for more detail.
The following is an example of what will be returned by Job.getCleanCopy when passing in a true value to priorityAsString. The property priority would be the number 40 if we did not set priorityAsString to true.
{ dateCreated: 2016-08-17T00:31:39.155Z,
dateEnable: 2016-08-17T00:31:39.155Z,
id: 'c7f759f2-53b7-4fa4-9cce-d45edbf23541',
log:
[ { date: 2016-08-17T00:31:39.280Z,
message: 'Job added to the queue',
queueId: 'WebDev:rjqJobQueue:rjqJobList:7210:01139a04-7c54-4e09-8a66-54fde8c5a059',
retryCount: 0,
status: 'waiting',
type: 'information' } ],
data: 'job data goes here',
priority: 'normal',
progress: 0,
queueId: 'WebDev:rjqJobQueue:rjqJobList:7210:01139a04-7c54-4e09-8a66-54fde8c5a059',
retryCount: 0,
retryDelay: 600000,
retryMax: 3,
status: 'waiting',
timeout: 300000 }This example is simply showing how to call Job.getCleanCopy. Notice the priorityAsString parameter is not being passed. The returned priority value will be 40.
const Queue = require('rethinkdb-job-queue')
const queue = new Queue()
const job = queue.createJob()
const cleanCopy = job.getcleanCopy()- 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