Skip to content

Commit

Permalink
Return if channel is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
vardius committed May 10, 2019
1 parent 0417bd5 commit 4b5279a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ func (p *pool) Start(maxWorkers int, fn interface{}) error {
for {
select {
case args, ok := <-p.queue:
if ok {
h.Call(args)
if !ok {
return
}

h.Call(args)
case <-p.ctx.Done():
return
}
Expand Down

0 comments on commit 4b5279a

Please sign in to comment.