Skip to content

Commit

Permalink
drain task before return
Browse files Browse the repository at this point in the history
  • Loading branch information
hongkuancn committed Sep 1, 2024
1 parent 7f4c992 commit 1b21aaa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ func worker(context context.Context, waitGroup *sync.WaitGroup, firstTask func()
// We have received a task, ignore it
taskWaitGroup.Done()
}
// Pool context was cancelled, empty tasks channel and exit
drainTasks(tasks, taskWaitGroup)
return

Check warning on line 36 in worker.go

View check run for this annotation

Codecov / codecov/patch

worker.go#L35-L36

Added lines #L35 - L36 were not covered by tests
default:
if task == nil || !ok {
Expand Down

0 comments on commit 1b21aaa

Please sign in to comment.