zhong
zhong copied to clipboard
Make zhong more reliable for frequent jobs
i'm finally reviewing some PRs now -- can you please write up a description of what this solves?
@nickelser Yes! Thank you for taking the time to review this.
I'll start by saying we're happily using this patch in production for more than a year (original PR: https://github.com/nickelser/zhong/pull/34, which we then iterated on and started using; the wallmine/zhong
branch)
With the way how grace period was implemented, jobs with specific at:
either could run more often than expected (every 1.minute ... at: '00:30'
could trigger a job multiple times), or not at all (every 1.day ... at: '00:30'
could miss the window and fail to run).
By setting the grace period to zero and directly comparing current time with a calculated prev_at
time (regardless of wether the job actually run before to easily support changing / new zhongs), the at
feature now works as expected for both low and high frequency zhongs with a specified time/date.
I see the tests failed; it seems this was caused by a comparison operator change affecting specific edge cases.
@nickelser I can easily ‘fix’ the tests but that would change the behaviour, not sure how you feel about that.
Tests also pass when the original less-than
operator is used, but I’m not sure if the update makes sense with it...
@nickelser Hey, long time no see 👋 wanted to report that we're still happily running our forked zhong in production, and also to inquire if you'd be interested in getting the changes here merged, or if I should instead close the issue. Thanks!