Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
fix: hold the task worker lock when starting task workers
Browse files Browse the repository at this point in the history
Otherwise, we could try to shutdown at the same time and race.
  • Loading branch information
Stebalien committed Jun 24, 2021
1 parent eac35a4 commit 24c356f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/decision/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ func (e *Engine) StartWorkers(ctx context.Context, px process.Process) {
e.bsm.start(px)
e.startScoreLedger(px)

e.taskWorkerLock.Lock()
defer e.taskWorkerLock.Unlock()

for i := 0; i < e.taskWorkerCount; i++ {
px.Go(func(px process.Process) {
e.taskWorker(ctx)
Expand Down

0 comments on commit 24c356f

Please sign in to comment.