fhmq / hmq

High performance mqtt broker
Apache License 2.0
1.32k stars 273 forks source link

rm a redundant creation of goroutines #179

Closed husy-dev closed 1 year ago

husy-dev commented 1 year ago
func (p *WorkerPool) dispatch() {
    for i := 0; i < p.maxWorkers; i++ {
        p.taskQueue[i] = make(chan func(), 1024)
        go startWorker(p.taskQueue[i])
    }
}

since function dispatch execute startWorker by goroutine, there is no need for startWorker to use goroutine inside.