Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ManuLpz4 opened this issue Jul 11, 2023 · 1 comment
Open

Comments

@ManuLpz4
Copy link

ManuLpz4 commented Jul 11, 2023

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",
    });
});
@baselshoban
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants