rm a redundant creation of goroutines (#179)

Co-authored-by: husyhu <husyhu@qq.com>
This commit is contained in:
Husy
2023-02-17 17:01:16 +08:00
committed by GitHub
parent 15f3f6d52e
commit 8430749ec4

View File

@@ -43,16 +43,14 @@ func (p *WorkerPool) dispatch() {
}
func startWorker(taskChan chan func()) {
go func() {
var task func()
var ok bool
for {
task, ok = <-taskChan
if !ok {
break
}
// Execute the task.
task()
var task func()
var ok bool
for {
task, ok = <-taskChan
if !ok {
break
}
}()
// Execute the task.
task()
}
}