Skip to content

Job.update

Grant Carthew edited this page Oct 10, 2016 · 16 revisions

Method Signature

Job.update(data, message, type, status)

Parameter: data Object Optional

  • Data that will be added to the update log entry log.data property.
  • Default: An empty object.

Parameter: message String Optional

  • String that will be added to the update log entry log.message property.

Parameter: type String Optional

  • String that will be added to the update log entry log.type property. Typically information, warning, or error.

Parameter: status String Optional

  • String that will be added to the update log entry log.status property.

Returns: Promise => true

Example:

job.update({ foo: 'bar'},
  'Job data changed',
  'warning',
  'active').catch(err => console.error(err))

Warning

The above signature is correct. The below text has not been update.

Description

The Job.update method enables you to customise a job any way you like. See the Job Editing document for more detail.

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('Changed foo to bar')
}).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