From 8c928539eec04f515baab004cd5025aa415a1b5d Mon Sep 17 00:00:00 2001 From: Patrick Mezard Date: Mon, 12 Oct 2015 10:42:14 +0200 Subject: [PATCH] upside_down: no need for a goroutine to enqueue AnalysisWork It boils down to: 1. client sends some work and a notification channel to a single worker, then waits. 2. worker processes the work 3. worker sends the result to the client using the notification channel I do not see any problem with this, even with unbuffered channels. --- index/upside_down/upside_down.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index/upside_down/upside_down.go b/index/upside_down/upside_down.go index f11c21d6..72182249 100644 --- a/index/upside_down/upside_down.go +++ b/index/upside_down/upside_down.go @@ -265,9 +265,7 @@ func (udc *UpsideDownCouch) Update(doc *document.Document) (err error) { resultChan := make(chan *index.AnalysisResult) aw := index.NewAnalysisWork(udc, doc, resultChan) // put the work on the queue - go func() { - udc.analysisQueue.Queue(aw) - }() + udc.analysisQueue.Queue(aw) // wait for the result result := <-resultChan