node-cron: Error: Something went wrong. cron reached maximum iterations
Time Zone: "" - Cron String: 0 0,30 * * * * - UTC offset: +00:00 - current Date: Mon Mar 16 2020 16:31:21 GMT+0000
cron@1.8.2 @types/cron@1.7.2
stacktrace:
at CronTime._getNextDateFrom (/usr/src/app/node_modules/cron/lib/cron.js:235:12)
at CronTime.sendAt (/usr/src/app/node_modules/cron/lib/cron.js:156:17)
at CronTime.getTimeout (/usr/src/app/node_modules/cron/lib/cron.js:175:29)
at CronJob.start (/usr/src/app/node_modules/cron/lib/cron.js:613:31)
at Timeout.callbackWrapper [as _onTimeout] (/usr/src/app/node_modules/cron/lib/cron.js:665:29)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
index.ts:
import cron from "cron";
...
cron.job("0 0,30 * * * *", () => task(arg), undefined, true);
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 8
- Comments: 24 (3 by maintainers)
Links to this issue
Commits related to this issue
- Revert to cron 1.7.2 See https://github.com/kelektiv/node-cron/issues/478 — committed to node-red/node-red by knolleary 4 years ago
- GH-467 GH-478 GH-469 GH-470 GH-497 GH-498 - Allow soft warning when a hard error isn't required. Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com> — committed to kelektiv/node-cron by ncb000gt 4 years ago
- GH-467 GH-478 GH-469 GH-470 GH-497 GH-498 - Allow soft warning when a hard error isn't required. Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com> — committed to kelektiv/node-cron by ncb000gt 4 years ago
- GH-467 GH-478 GH-469 GH-470 GH-497 GH-498 - Allow soft warning when a hard error isn't required. Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com> — committed to kelektiv/node-cron by ncb000gt 4 years ago
- GH-467 GH-478 GH-469 GH-470 GH-497 GH-498 - Allow soft warning when a hard error isn't required. Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com> — committed to kelektiv/node-cron by ncb000gt 4 years ago
- Update: lock cron dep due to https://github.com/kelektiv/node-cron/issues/478 — committed to geut/permanent-seeder by dpaez 3 years ago
I realized the error would show whenever my CPU utilization is too high (>9x%). That might cause some delay of code and affect something.
yes, it reappeared, though solved in
1.7one year agocron@1.8.2
I pushed up a PR with some changes to allow a “soft warning”. Can you please test and report back?
@rusekr
Yea. I hear you re: still occurring.
This pr is to hopefully allow the developer to make the decision at to whether ms precision is necessary or not rather than throwing an exception.
I can take care of the warning showing at all later. Thanks for the docs.
As for the first point, re: default of false. I think you’re right. I’ll default it to true.
Great PR - it converts bug to feature, but if default for softTimeout is false - it is breaking change (with main commit caused this issue). And after upgrade to newer versions people must add this config in all cronjobs.
Meanwhile - even with softTimeout turned on this warning may occur in between server syncing time with ntp or changin from/to dst. Fot this js now have: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now and some examples https://developers.google.com/web/updates/2012/08/When-milliseconds-are-not-enough-performance-now Page on nodejs https://nodejs.org/api/perf_hooks.html#perf_hooks_performance_now
May be use this instead?
Thinking (but not tested) it related to this commit: https://github.com/kelektiv/node-cron/commit/e1b392f244025bbc833d648b33d01ee191640890 Can anyone test without it?
Reverted back to 1.7.2 for now.