Skip to content

Cancel Job

Grant Carthew edited this page Sep 27, 2016 · 8 revisions

Description

For any number of reasons you may need to cancel a job currently in the queue. There are two ways you can do this; using Queue.cancelJob, or by calling next() passing a customized Error object.

This document explains the differences and when to use them.

Queue.cancelJob

The Queue.cancelJob method can be called while a job is in the queue with a waiting, failed, or active status. By calling the Queue.cancelJob method you will cause the job to change status to cancelled which will permanently prevent the job from being picked up for processing.

If you are using rethinkdb-job-queue in a distributed environment and you have the change feed option enabled for your worker Queue objects, calling Queue.cancelJob will be received by all Queue objects. If you cancel the job from a Queue object that is not processing the job, and the job is being processed by another Queue object, a Queue.process callback called onCancel will be invoked. This will allow the Queue object processing the job to gracefully stop the processing of the job.

Main

How It Works

Contributing

API

Queue Methods

Queue Properties

Queue Events

Job Methods

Job Properties

Documentation

Clone this wiki locally