Cancel
pulse.cancel(query)
pulse.cancel(query)
Example Usage
const pulse = new Pulse();
// Example of canceling all jobs with a specific priority
const query = { priority: { $lt: 0 } }; // Cancels all jobs with a negative priority
pulse.cancel(query)
.then(deletedCount => console.log(`${deletedCount} low priority jobs cancelled`))
.catch(error => console.error('Failed to cancel jobs:', error));
Parameters
query
(Filter<Document>
): A MongoDB query that specifies which jobs to cancel and delete. This query should conform to MongoDB's query standards and can include various criteria to match specific jobs.
Returns
Promise<number | undefined>
: Returns a promise that resolves with the number of jobs deleted from the database. If no jobs are found that match the query, the promise may resolve toundefined
or0
.
Last updated
Was this helpful?