From d9c40b582a8c7b861884b9ed9990eed79cd5e2af Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Fri, 3 Feb 2017 18:42:11 -0500 Subject: [PATCH] Use buffered channels in AllKeysChan to increase performance. License: MIT Signed-off-by: Kevin Atkinson --- filestore/filestore.go | 3 ++- filestore/fsrefstore.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/filestore/filestore.go b/filestore/filestore.go index c4ae6ce03fb..701b01bd692 100644 --- a/filestore/filestore.go +++ b/filestore/filestore.go @@ -7,6 +7,7 @@ import ( "github.com/ipfs/go-ipfs/blocks/blockstore" posinfo "github.com/ipfs/go-ipfs/thirdparty/posinfo" + dsq "gx/ipfs/QmRWDav6mzWseLWeYfVd5fvUKiVe9xNH29YfMF438fG364/go-datastore/query" logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log" cid "gx/ipfs/QmcTcsTvfaeEBRFo1TkFgT8sRmgi1n1LTZpecfVP8fzpGD/go-cid" ) @@ -30,7 +31,7 @@ func (f *Filestore) AllKeysChan(ctx context.Context) (<-chan *cid.Cid, error) { return nil, err } - out := make(chan *cid.Cid) + out := make(chan *cid.Cid, dsq.KeysOnlyBufSize) go func() { defer cancel() defer close(out) diff --git a/filestore/fsrefstore.go b/filestore/fsrefstore.go index 527590d7d46..5a261c0ecbb 100644 --- a/filestore/fsrefstore.go +++ b/filestore/fsrefstore.go @@ -48,7 +48,7 @@ func (f *FileManager) AllKeysChan(ctx context.Context) (<-chan *cid.Cid, error) return nil, err } - out := make(chan *cid.Cid) + out := make(chan *cid.Cid, dsq.KeysOnlyBufSize) go func() { defer close(out) for {