@cryptotaxi247 / kubo / commits / 8082af798

Use buffered channels in AllKeysChan to increase performance.

License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>

Kevin Atkinson committed Feb 3, 2017 at 18:42 UTC 8082af7988f76be4aae1de567b5a201723b57cb2
2 files changed +3 -2
filestore/filestore.go
+2 -1
@@ -7,6 +7,7 @@ import (
7 "github.com/ipfs/go-ipfs/blocks/blockstore"
8 posinfo "github.com/ipfs/go-ipfs/thirdparty/posinfo"
9
10 + dsq "gx/ipfs/QmRWDav6mzWseLWeYfVd5fvUKiVe9xNH29YfMF438fG364/go-datastore/query"
11 logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
12 cid "gx/ipfs/QmV5gPoRsjN1Gid3LMdNZTyfCtP2DsvqEbMAmz82RmmiGk/go-cid"
13 )
@@ -30,7 +31,7 @@ func (f *Filestore) AllKeysChan(ctx context.Context) (<-chan *cid.Cid, error) {
31 return nil, err
32 }
33
33 - out := make(chan *cid.Cid)
34 + out := make(chan *cid.Cid, dsq.KeysOnlyBufSize)
35 go func() {
36 defer cancel()
37 defer close(out)
filestore/fsrefstore.go
+1 -1
@@ -48,7 +48,7 @@ func (f *FileManager) AllKeysChan(ctx context.Context) (<-chan *cid.Cid, error)
48 return nil, err
49 }
50
51 - out := make(chan *cid.Cid)
51 + out := make(chan *cid.Cid, dsq.KeysOnlyBufSize)
52 go func() {
53 defer close(out)
54 for {