-
Notifications
You must be signed in to change notification settings - Fork 625
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
Cron Job executing twice on a single scheduled job #489
Comments
Can you share aa base code sample that replicates what you're seeing (without any extra custom code)? |
Yes, sure!
|
Does the execution seem to always happen twice for every execution of the onTick after 3 days? Is it always 3 days? I'm asking because I have an instance of this running myself and it doesn't perform this way and until somewhat recently I had it running for a couple months without the behavior your describing. Is there something else that may be causing this? Have you reviewed your processes to make sure that only the one is running? Are you using a process manager to watch your processes and keep them alive (maybe there is something going on with that)? |
Yes, it usually starts to run twice after 3 days. And I am able to fix it by changing the time to 1 minute earlier, however, 3 days later, the same issue will happen again. I have also used other npm cron such as the cron-scheduler however, the same issue still occurs. And no, I was not using any process manager. |
This comment was marked as off-topic.
This comment was marked as off-topic.
I am also noticing this problem. Usually speaking they both start of fine for a couple of days and then they would start running an additional time every couple days. I would usually just restart the service and it would be good for a couple days. However this time it started straight away, 25th - 1 Time |
Did anyone found a solution, mine is executing at-most 3 times. |
Solved by running cron in fork mode rather than in cluster mode. But how can I distribute the cron task without executing the same task again in the next thread? |
I transfer funds with this cron job and I have to find a solution for it or I have to change my execution strategy to something wilder than this package. @vikram1992 how can I run it in "fork mode"? |
This comment was marked as off-topic.
This comment was marked as off-topic.
hey thanks for looking into it. we'll probably rewrite the |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
These comments not being related to the original issue, I'm hiding them to reduce noise. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Try running the scheduler using fork mode instead of cluster mode if using pm2. |
Hey @ianfirdaus31 👋 did you encounter this issue recently? |
Nope, it was fixed by the way i explained above |
Closing this since no one reported encountering this bug in more than a year. Using
|
Hey so, every single time after the system runs for like 3 days, it will run into an issue whereby the cron job will simply execute twice on a single scheduled job.
The text was updated successfully, but these errors were encountered: