node-cron / node-cron

A simple cron-like job scheduler for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Array mapping to create multiple crons but only the first one runs

ManuLpz4 opened this issue · comments

Description

When I use uploadOperationsCrons.forEach((job) => job.start()); only the first one (14:10) keeps running.

Code example:

const cronTimes = ["10 14 * * 1-5", "10 15 * * 1-5", "10 16 * * 1-5"];
const cronJobs = cronTimes.map((cronTime) => {
    return new CronJob({
        cronTime,
        onTick: () => {
            altaSuscripcion();
            altaRescateCP();
            altaRescateM();
        },
        timeZone: "America/Argentina/Buenos_Aires",
    });
});

Hello @ManuLpz4,
I don't see how this is related to node-cron module as I don't see any usage of it in the example you provided.
I see that you are using a CronJob class but I don't see such a class defined in the module.