const { Queue } = require("bullmq"); const connection = { host: "127.0.0.1", port: 6379 }; const queue = new Queue("skynet", { connection }); async function dropJob() { const job = await queue.add( "heartbeat", { at: Date.now() }, { attempts: 3, backoff: { type: "exponential", delay: 1000 }, removeOnComplete: 200, removeOnFail: 200 } ); console.log(`[${new Date().toISOString()}] enqueued job ${job.id}`); } (async () => { console.log("30s scheduler started..."); while (true) { await dropJob(); await new Promise(r => setTimeout(r, 30000)); // 30 sec delay } })();