-
Notifications
You must be signed in to change notification settings - Fork 131
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
due_at
date calculation appears to be incorrect
#210
Comments
good catch, what would you propose to fix? |
In my code I've monkeypatched def due_at(self):
# never run => due now
if self.last_run_at is None:
return self._default_now()
delta = self.schedule.remaining_estimate(self.last_run_at)
# if no delta, means no more events after the last_run_at.
if delta is None:
return None
# overdue => due now
if delta.total_seconds() < 0:
return self._default_now()
return self.default_now() + delta ie. just changing the last line to use |
I think I might be getting bitten by this, I run very frequent periodic tasks (i.e. every couple of seconds) and occasionally tasks stop kicking off for exactly 5mn, which looks suspiciously like the default Applying the change suggested by @simonk52 definitely breaks the test suite, specifically |
The
RedBeatSchedulerEntry.due_at
function appears to be incorrect. Here's the definition:redbeat/redbeat/schedulers.py
Lines 251 to 266 in 82110c5
self.schedule.remaining_estimate
returns the number of seconds until the task is due, counting from the current time, but the function ends up adding that delta toself.last_run_at
.Here's a test demonstrating the problem:
The text was updated successfully, but these errors were encountered: