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

Error: Something went wrong. cron reached maximum iterations. #608

Closed
kennycharles opened this issue Apr 28, 2022 · 2 comments
Closed

Error: Something went wrong. cron reached maximum iterations. #608

kennycharles opened this issue Apr 28, 2022 · 2 comments

Comments

@kennycharles
Copy link

Full ERROR:

Error: Something went wrong. cron reached maximum iterations.
Please open an issue (https://github.com/kelektiv/node-cron/issues/new) and provide the following string
Time Zone: "" - Cron String: 0 0,10,20,30,40,50 * * * * - UTC offset: -04:00 - current Date: Mon Apr 25 2022 16:20:13 GMT+0000
at CronTime._getNextDateFrom (/root/apps/adew/node_modules/cron/lib/cron.js:235:12)
at CronTime.sendAt (/root/apps/adew/node_modules/cron/lib/cron.js:156:17)
at CronTime.getTimeout (/root/apps/adew/node_modules/cron/lib/cron.js:175:29)
at CronJob.start (/root/apps/adew/node_modules/cron/lib/cron.js:613:31)
at Timeout.callbackWrapper [as _onTimeout] (/root/apps/adew/node_modules/cron/lib/cron.js:665:29)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7)

@AbdelrahmanHafez
Copy link

AbdelrahmanHafez commented May 6, 2022

Welcome to GitHub @kennycharles
I actually recently found out about how simple this is.

You simply pass a date object in the future instead of the expression.

const { CronJob } = require('cron');
const job = new CronJob(
	new Date('2022-05-10T20:55:53.182Z'),
	function() {
		console.log('You will see this message exactly at that date');
	}
);

job.start();

@intcreator
Copy link
Collaborator

please close this issue and refer to the canonical issue at #467. if you get an error message telling you to open a new issue it's because you're using an old version of node-cron

@intcreator intcreator closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2023
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

3 participants