-
Notifications
You must be signed in to change notification settings - Fork 1.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
[usage] Refactor controller package into scheduler #12831
Conversation
bb0f3f4
to
5f90ea5
Compare
8390b0b
to
8b65faa
Compare
# This is the 1st commit message: [usage] Refactor controller package into scheduler # This is the commit message #2: [usage] Refactor controller package into scheduler
8b65faa
to
aa51c3b
Compare
select { | ||
// attempt a write to signal we want to run | ||
case r.running <- struct{}{}: | ||
// we managed to write, there's no other job executing. Cases are not fall through so we continue executing our main logic. | ||
default: | ||
// we could not write, so another instance is already running. Skip current run. | ||
log.Infof("Skipping ledger run, another run is already in progress.") | ||
return nil | ||
} |
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.
Mutex logic moves into the job, away from the controller itself. This is needed to allow us to run multiple control loops with the same scheduler.
@@ -16,26 +16,26 @@ const ( | |||
) | |||
|
|||
var ( | |||
reconcileStartedTotal = prometheus.NewCounterVec(prometheus.CounterOpts{ | |||
jobStartedSeconds = prometheus.NewCounterVec(prometheus.CounterOpts{ |
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.
These are now general job metrics, rather than specific for the reconcile with ledger. If a job desires more metrics, those can be added in job direclty rather than on the scheduler level.
aa51c3b
to
972ee4f
Compare
972ee4f
to
0d1f67c
Compare
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.
/hold for a couple of questions
0d1f67c
to
f98b45b
Compare
f98b45b
to
675be73
Compare
/unhold |
Description
Refactor existing controller package into the following:
Related Issue(s)
Fixes #
How to test
Unit
Release Notes
Documentation
Werft options: