zhong icon indicating copy to clipboard operation
zhong copied to clipboard

Make zhong more reliable for frequent jobs

Open gyfis opened this issue 3 years ago • 4 comments

gyfis avatar Oct 01 '20 09:10 gyfis

i'm finally reviewing some PRs now -- can you please write up a description of what this solves?

nickelser avatar Jan 21 '21 18:01 nickelser

@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.

gyfis avatar Jan 21 '21 20:01 gyfis

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...

gyfis avatar Jan 22 '21 06:01 gyfis

@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!

gyfis avatar Dec 06 '22 22:12 gyfis