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

Timer reference to 'now' not reset on delete #206

Closed
ddelger opened this issue Jul 9, 2019 · 3 comments
Closed

Timer reference to 'now' not reset on delete #206

ddelger opened this issue Jul 9, 2019 · 3 comments

Comments

@ddelger
Copy link

ddelger commented Jul 9, 2019

In the internal loop of the run method the local variable now is updated when a new entry is added but not deleted.

https://github.com/robfig/cron/blob/v3/cron.go#L280

This results in the timer getting reset based an on outdated reference to now. Causing the trigger to later than specified.

https://github.com/robfig/cron/blob/v3/cron.go#L244

@robfig
Copy link
Owner

robfig commented Jul 11, 2019

Thank you for the bug report! I agree that looks incorrect. I'll work on adding a test to catch it and then fix the bug.

robfig pushed a commit that referenced this issue Jul 11, 2019
Add a test to detect it and fix the bug.

Fixes issue #206
@robfig
Copy link
Owner

robfig commented Jul 11, 2019

I was able to reproduce and fix the bug. Thank you!

@robfig robfig closed this as completed Jul 11, 2019
@ddelger
Copy link
Author

ddelger commented Jul 12, 2019

Great thanks!

I also just noticed a pr to add update functionality. I would imagine the same issue would occur here as well.

https://github.com/robfig/cron/pull/183/files

haiheipijuan pushed a commit to haiheipijuan/cron that referenced this issue Jun 15, 2021
Add a test to detect it and fix the bug.

Fixes issue robfig#206
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