-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
ref(crons): Use redis GETSET over a lock for synchronization #54341
ref(crons): Use redis GETSET over a lock for synchronization #54341
Conversation
dda7344
to
b135552
Compare
|
||
# If more than exactly a minute has passed then we've skipped a | ||
# task run, report that to sentry, it is a problem. | ||
if last_ts is not None and last_ts + 60 != reference_ts: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if last_ts
is None
do we want to process? or wait for a full minute for it to clear out/increment?
feel like we should process in the case of deployments etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's OK to process it yeah.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do already, this is just guarding the exception logic for when it skips
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh right i was reading this backwards
Instead of taking a lock when ticking the monitor tasks trigger clock, we can use redis' `GETSET` command to retrieve the current value and set a new value atomically.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #54341 +/- ##
==========================================
- Coverage 79.66% 79.66% -0.01%
==========================================
Files 4985 4985
Lines 211352 211346 -6
Branches 36026 36026
==========================================
- Hits 168373 168365 -8
- Misses 37800 37804 +4
+ Partials 5179 5177 -2
|
b135552
to
0747aef
Compare
Instead of taking a lock when ticking the monitor tasks trigger clock,
we can use redis'
GETSET
command to retrieve the current value and seta new value atomically.
This addresses @fpacifici's feedback here #53661 (comment)