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

cron.Run() method allows set Now from method argument. #356

Open
fanzhao1986 opened this issue Nov 25, 2020 · 1 comment
Open

cron.Run() method allows set Now from method argument. #356

fanzhao1986 opened this issue Nov 25, 2020 · 1 comment

Comments

@fanzhao1986
Copy link

Cron package currently sets scheduler and then initialize cron.Run() based on the current time NOW. Is there possible, we can set NOW from cron.Cron.Run(now time.Time) method. Then use an old time may trigger multi callbacks immerdietely. This may be a nicer feature for test purpose or replay application.

@ashwin153
Copy link

ashwin153 commented Sep 22, 2021

Came across this while building a scheduler service based on cron. When the service is restarted, I want it to run any jobs that it missed while it was down. Would it be possible to add a way to get the last time that cron.Cron was run for and to run cron.Cron as of a time in the past? Then, I could persist this timestamp before shutting down my service and use this timestamp to resume from where I left off on restart.

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