Skip to content

Commit

Permalink
reschedule limit mode was broken - fixing the inc/dec
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRoesler committed Sep 21, 2023
1 parent 269c4d1 commit f61f2e4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ func (e *executor) start() {
}

func (e *executor) runJob(f jobFunction) {
defer func() {
if e.limitMode == RescheduleMode && e.limitModeMaxRunningJobs > 0 {
e.limitModeRunningJobs.Add(-1)
}
}()
switch f.runConfig.mode {
case defaultMode:
lockKey := f.jobName
Expand Down Expand Up @@ -244,6 +249,7 @@ func (e *executor) run() {
if e.limitModeRunningJobs.Load() < int64(e.limitModeMaxRunningJobs) {
select {
case e.limitModeQueue <- f:
e.limitModeRunningJobs.Inc()
case <-e.ctx.Done():
}
}
Expand Down

0 comments on commit f61f2e4

Please sign in to comment.