From eb3216d35440076d16b2d7ff9973fc7c5dcd802b Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Mon, 16 Dec 2019 06:40:52 -0800 Subject: [PATCH] Fix: Use buffered channel of size 1 to avoid goroutine leaks --- processor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/processor.go b/processor.go index 6a9436e..8653401 100644 --- a/processor.go +++ b/processor.go @@ -94,7 +94,7 @@ func (p *processor) exec() { go func() { defer func() { <-p.sema /* release token */ }() - resCh := make(chan error) + resCh := make(chan error, 1) task := &Task{Type: msg.Type, Payload: msg.Payload} go func() { resCh <- perform(p.handler, task)