remove noisy log, simplify job interface (#10975)
This commit is contained in:
parent
f33fda0d87
commit
38a647c6e5
|
@ -14,13 +14,8 @@ type testJob struct {
|
|||
onFail func(error)
|
||||
}
|
||||
|
||||
// TODO maybe define these function types
|
||||
func (t *testJob) GetID() string {
|
||||
return t.id
|
||||
}
|
||||
|
||||
func (t *testJob) Execute() error {
|
||||
return t.ex(t.GetID())
|
||||
return t.ex(t.id)
|
||||
}
|
||||
|
||||
func (t *testJob) OnFailure(err error) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
|
||||
// Job is an interface for jobs used with this job manager
|
||||
type Job interface {
|
||||
GetID() string
|
||||
Execute() error
|
||||
OnFailure(err error)
|
||||
}
|
||||
|
@ -37,7 +36,6 @@ func (w *worker) start() {
|
|||
w.wg.Done()
|
||||
return
|
||||
case job := <-w.jobCh:
|
||||
w.logger.Trace("starting new job", "worker", w.name, "job_id", job.GetID())
|
||||
err := job.Execute()
|
||||
if err != nil {
|
||||
job.OnFailure(err)
|
||||
|
|
|
@ -161,10 +161,6 @@ func newRevocationJob(nsCtx context.Context, leaseID, nsID string, m *Expiration
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (r *revocationJob) GetID() string {
|
||||
return r.leaseID
|
||||
}
|
||||
|
||||
func (r *revocationJob) Execute() error {
|
||||
metrics.IncrCounterWithLabels([]string{"expire", "lease_expiration"}, 1, []metrics.Label{{"namespace", r.nsID}})
|
||||
|
||||
|
|
Loading…
Reference in New Issue