blazerjob
Version:
TypeScript library for scheduling, executing, and managing asynchronous tasks (custom, HTTP) with a SQLite backend.
25 lines (19 loc) • 472 B
text/typescript
import { BlazeJob } from '../index';
const jobs = new BlazeJob({ dbPath: './test_http_interval.db' });
let callCount = 0;
jobs.schedule(undefined, {
runAt: new Date(),
interval: 2000, // 2s for test speed
type: 'http',
config: JSON.stringify({
url: 'https://httpbin.org/get',
method: 'GET'
})
});
jobs.start();
// Stop after 3 calls (simulate interval)
setTimeout(() => {
jobs.stop();
console.log('Test finished.');
process.exit(0);
}, 7000);