Skip to content

Job.update

Grant Carthew edited this page May 8, 2017 · 16 revisions

Method Signature

Job.update()

Returns: Promise => Job

Example:

job.update().catch(err => console.error(err))

Description

The Job.update method pushes any changes to the job properties to the database. It enables you to customize a job any way you like. See the Job Editing document for more detail.

When the Job.update method is called a job log entry is added automatically. The log.data property contains a copy of the old job data excluding the Job.log property.

Example

This example changes the data of the job.

const Queue = require('rethinkdb-job-queue')
const q = new Queue()

const job = q.createJob({ data: 'foo' })


return q.addJob(job).then(() => {
  return q.getJob(job)
}).then((jobs) => {
  jobs[0].data = 'bar'
  return jobs[0].update()
}).catch(err => console.error(err))

Main

How It Works

Contributing

API

Queue Methods

Queue Properties

Queue Events

Job Methods

Job Properties

Documentation

Clone this wiki locally