Skip to content

Commit 2b3bd24

Browse files
kevinawhyrusleeping
authored andcommitted
Use buffered channels in AllKeysChan to increase performance.
License: MIT Signed-off-by: Kevin Atkinson <[email protected]>
1 parent 220a47f commit 2b3bd24

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

filestore/filestore.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/ipfs/go-ipfs/blocks/blockstore"
88
posinfo "github.com/ipfs/go-ipfs/thirdparty/posinfo"
99

10+
dsq "gx/ipfs/QmRWDav6mzWseLWeYfVd5fvUKiVe9xNH29YfMF438fG364/go-datastore/query"
1011
logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
1112
cid "gx/ipfs/QmcTcsTvfaeEBRFo1TkFgT8sRmgi1n1LTZpecfVP8fzpGD/go-cid"
1213
)
@@ -30,7 +31,7 @@ func (f *Filestore) AllKeysChan(ctx context.Context) (<-chan *cid.Cid, error) {
3031
return nil, err
3132
}
3233

33-
out := make(chan *cid.Cid)
34+
out := make(chan *cid.Cid, dsq.KeysOnlyBufSize)
3435
go func() {
3536
defer cancel()
3637
defer close(out)

filestore/fsrefstore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (f *FileManager) AllKeysChan(ctx context.Context) (<-chan *cid.Cid, error)
4848
return nil, err
4949
}
5050

51-
out := make(chan *cid.Cid)
51+
out := make(chan *cid.Cid, dsq.KeysOnlyBufSize)
5252
go func() {
5353
defer close(out)
5454
for {

0 commit comments

Comments
 (0)