Skip to content

Commit 0f87395

Browse files
committed
Add buffer to collector channels (go 1.5 fix)
This commit stops the errors seen in - golang/go#11035 - specifically golang/go#11035 (comment) However, in general it is not ideal to make these channels buffered and really they should not need to be buffered. Past experience has shown that buffering the "send to collector" channel simply masks performance problems until sufficient memory pressure is reached. It is far better to distribute the work evenly accross all the collectors (which was implemented in 05fa9e9 If the Go 1.5 runtime bug gets fixed this change can be safely reverted. Signed-off-by: Tim Henderson <[email protected]>
1 parent 3a4c002 commit 0f87395

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mine/mine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func (m *Miner) makeCollectors(N int) *Collectors {
326326
chs := make([]chan<- *labelGraph, 0, N)
327327
for i := 0; i < N; i++ {
328328
tree := m.MakeStore()
329-
ch := make(chan *labelGraph)
329+
ch := make(chan *labelGraph, 1)
330330
trees = append(trees, tree)
331331
chs = append(chs, ch)
332332
go m.collector(tree, ch)

0 commit comments

Comments
 (0)