UNPKG

blazerjob

Version:

TypeScript library for scheduling, executing, and managing asynchronous tasks (custom, HTTP) with a SQLite backend.

22 lines (21 loc) 576 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("../index"); const jobs = new index_1.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);