Manually processing jobs
const worker = new Worker('my-queue');
// Specify a unique token
const token = 'my-token';
const job = (await worker.getNextJob(token)) as Job;
// Access job.data and do something with the job
// processJob(job.data)
if (succeeded) {
await job.moveToCompleted('some return value', token, false);
} else {
await job.moveToFailed(new Error('my error message'), token, false);
}
await worker.close();Choosing a token
Checking for stalled jobs
Looping through jobs
Rate Limiting
Read more:
Last updated
Was this helpful?