Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default () => {
const scheduler = new NodeResque.Scheduler({
connection: storage.resqueConfig,
});
scheduler.on('start', () => {
logger('info', 'scheduler: started');
});
scheduler.on('end', () => {
logger('info', 'scheduler: ended');
});
// scheduler.on('poll', () => {
// logger('info', 'scheduler: polling');
// });
scheduler.on('master', () => {
private async startScheduler(): Promise {
if (this.api.configs.tasks.scheduler !== true) {
return;
}
this.schedulerLogging = this.api.configs.tasks.schedulerLogging;
this.scheduler = new NodeResque.Scheduler({
connection: this.connectionDetails,
timeout: this.api.configs.tasks.timeout,
});
this.scheduler.on("error", error =>
this.api.log(error, LogLevel.Error, "[api.resque.scheduler]"),
);
await this.scheduler.connect();
this.scheduler.on("start", () =>
this.api.log("resque scheduler started", this.schedulerLogging.start),
);
this.scheduler.on("end", () =>
this.api.log("resque scheduler ended", this.schedulerLogging.end),
);