Attempt fetch entry from Redis on update_from_dict (#151) #281
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As mentioned in this issue , upon restart,
redbeat
is not able to pick up the persistedlast_run_at
(in Redis), but instead is defaulting to the current datetime forlast_run_at
.As a result, tasks end up being scheduled inconsistently between restarts. In larger systems where restarts could be more frequent, this behaviour be impactful.
This PR adds logic to that attempts to fetch an entry from Redis first, using its generated Redis key.
If the key is not found in Redis, only then we can proceed to create a new entry.
Before fix (overdue task):
We can observe the task was sent only 25 seconds after the restart of
redbeat
although it was long overdue.(The delta is 25 seconds)
After fix (overdue task):
We can observe that the task was sent as soon as
redbeat
was restarted since it was long overdue.