Skip to content

Commit

Permalink
fix for high cpu usage (#386)
Browse files Browse the repository at this point in the history
* fix for high cpu usage

* Update go_test.yml

* Update file_formatting.yml

* revert file_formatting.yml to original

* newline

Co-authored-by: John Roesler <johnrroesler@gmail.com>
  • Loading branch information
mistu4u and JohnRoesler committed Oct 17, 2022
1 parent 3867b42 commit af043b7
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions executor.go
Expand Up @@ -67,18 +67,17 @@ func (e *executor) start() {
case RescheduleMode:
return
case WaitMode:
for {
select {
case <-stopCtx.Done():
return
case <-f.ctx.Done():
return
default:
}

if e.maxRunningJobs.TryAcquire(1) {
break
}
select {
case <-stopCtx.Done():
return
case <-f.ctx.Done():
return
default:
}

if err := e.maxRunningJobs.Acquire(f.ctx, 1); err != nil {
break

}
}
}
Expand Down

0 comments on commit af043b7

Please sign in to comment.