blazerjob
Version:
TypeScript library for scheduling, executing, and managing asynchronous tasks (custom, HTTP, Cosmos) with a SQLite backend.
22 lines (21 loc) • 631 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("../index");
const jobs = new index_1.BlazeJob({ dbPath: './test_http_retry_prio.db', autoExit: true });
jobs.schedule(async () => { }, {
runAt: new Date(),
interval: 2000,
type: 'http',
config: JSON.stringify({
url: 'https://httpbin.org/status/503',
method: 'GET'
}),
retriesLeft: 1,
priority: 10,
maxRuns: 3,
maxDurationMs: 7000,
onEnd: (stats) => {
console.log(`Résumé : exécutions = ${stats.runCount}, erreurs = ${stats.errorCount}`);
}
});
jobs.start();