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

Running multiple times #86

Closed
mjafartp opened this issue Apr 21, 2022 · 1 comment
Closed

Running multiple times #86

mjafartp opened this issue Apr 21, 2022 · 1 comment

Comments

@mjafartp
Copy link

My production env has 2 instances of application running (Running app over PM2 )
Currently, this cron running 2 times in my application how to limit to 1?

@mjafartp mjafartp changed the title [question] Running multipple times [question] Running multiple times Apr 21, 2022
@Hexagon
Copy link
Owner

Hexagon commented Apr 21, 2022

So croner is running according to the schedule, but since you have multiple instances you get multiple executions each time? Could you add a check so that croner starts only if process.env.pm_id is 0 (first instance) or something like that?

https://stackoverflow.com/questions/44554336/node-app-instance-name-when-running-via-pm2-cluster

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

No branches or pull requests

2 participants