@cavai/adonis-queue
Version:
Basic AdonisJS queue provider
35 lines (34 loc) • 811 B
JavaScript
import { Dispatcher } from './dispatcher.js';
export class BaseJob {
constructor(..._) { }
/**
* Nr of times job is re-tried before it is marked as failed
*/
static retries = 0;
/**
* Delay for retries in seconds, so other jobs get chance to run
*/
static retryAfter = 5;
/**
* Filesystem path to job class
*/
static classPath;
/**
* Instance of queue manager
*/
static queueManager;
/**
* Sets queueManager to current job
*/
static useQueue(queueManager) {
this.queueManager = queueManager;
}
/**
* Dispatches job to be queued up for execution
*
* @param data Data to pass to job class instance
*/
static dispatch(...data) {
return new Dispatcher(this, data);
}
}