test all remaining With*, and test logger (#609)

This commit is contained in:
John Roesler
2023-11-09 15:04:18 -06:00
committed by GitHub
parent 6f9a8200f4
commit 4a57125579
7 changed files with 414 additions and 77 deletions
+24 -18
View File
@@ -326,30 +326,36 @@ func (e *executor) limitModeRunner(name string, in chan uuid.UUID, wg *waitGroup
}
func (e *executor) runJob(j internalJob) {
if j.ctx == nil {
return
}
select {
case <-e.ctx.Done():
return
case <-j.ctx.Done():
return
default:
if e.elector != nil {
if err := e.elector.IsLeader(j.ctx); err != nil {
return
}
}
_ = callJobFuncWithParams(j.beforeJobRuns, j.id)
}
select {
case <-e.ctx.Done():
if e.elector != nil {
if err := e.elector.IsLeader(j.ctx); err != nil {
return
case <-j.ctx.Done():
return
case e.jobIDsOut <- j.id:
}
err := callJobFuncWithParams(j.function, j.parameters...)
if err != nil {
_ = callJobFuncWithParams(j.afterJobRunsWithError, j.id, err)
} else {
_ = callJobFuncWithParams(j.afterJobRuns, j.id)
}
}
_ = callJobFuncWithParams(j.beforeJobRuns, j.id)
select {
case <-e.ctx.Done():
return
case <-j.ctx.Done():
return
case e.jobIDsOut <- j.id:
}
err := callJobFuncWithParams(j.function, j.parameters...)
if err != nil {
_ = callJobFuncWithParams(j.afterJobRunsWithError, j.id, err)
} else {
_ = callJobFuncWithParams(j.afterJobRuns, j.id)
}
}