2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-12-27 00:02:19 +08:00

Fix: Use buffered channel of size 1 to avoid goroutine leaks

This commit is contained in:
Ken Hibino 2019-12-16 06:40:52 -08:00
parent 989b2b6d55
commit eb3216d354

View File

@ -94,7 +94,7 @@ func (p *processor) exec() {
go func() { go func() {
defer func() { <-p.sema /* release token */ }() defer func() { <-p.sema /* release token */ }()
resCh := make(chan error) resCh := make(chan error, 1)
task := &Task{Type: msg.Type, Payload: msg.Payload} task := &Task{Type: msg.Type, Payload: msg.Payload}
go func() { go func() {
resCh <- perform(p.handler, task) resCh <- perform(p.handler, task)