Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const cron = require("node-cron");
- let queue = getItems();
- console.log("Queued", queue);
- function getItems() {
- return Array(10).fill(0).map(i => Math.floor(Math.random() * 100))
- }
- cron.schedule("* * * * *", () => {
- queue = getItems();
- console.log("Queued", queue);
- });
- cron.schedule("*/5 * * * * *", () => {
- item = queue.splice(0, 1);
- console.log("Executing", item);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement