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.
This commit is contained in:
parent
9b16fa6528
commit
8c928539ee
@ -265,9 +265,7 @@ func (udc *UpsideDownCouch) Update(doc *document.Document) (err error) {
|
|||||||
resultChan := make(chan *index.AnalysisResult)
|
resultChan := make(chan *index.AnalysisResult)
|
||||||
aw := index.NewAnalysisWork(udc, doc, resultChan)
|
aw := index.NewAnalysisWork(udc, doc, resultChan)
|
||||||
// put the work on the queue
|
// put the work on the queue
|
||||||
go func() {
|
|
||||||
udc.analysisQueue.Queue(aw)
|
udc.analysisQueue.Queue(aw)
|
||||||
}()
|
|
||||||
|
|
||||||
// wait for the result
|
// wait for the result
|
||||||
result := <-resultChan
|
result := <-resultChan
|
||||||
|
Loading…
Reference in New Issue
Block a user