const { JobBase } = require('@knetik/micro-queue'); module.exports = class {{name}}Job extends JobBase { static perform(App, params, progress) { App.Logger.info('performing {{name}}Job'); /* ====== EXAMPLE USAGE ========= */ App.Logger.info('{{name}}Job', params); let pending = 100; let total = 0; // Jobs must return a Promise return new Promise((resolve, reject) => { const interval = setInterval(() => { pending -= 1; total += 1; App.Logger.info('{{name}}Job progress', pending); // use progress to increment the jobs progress status progress(total); if (!pending) { resolve('done'); clearInterval(interval); } }, 1000); }); /* ====== END EXAMPLE USAGE ========= */ } }; // Set the max concurrency value for this job. module.exports.concurrency = 50;