Merge pull request #4811 from filecoin-project/raulk/badger-ctx-tests
badger blockstore: minor improvements
This commit is contained in:
commit
a389622ac6
@ -359,7 +359,11 @@ func (b *Blockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
|
||||
buf = make([]byte, reqlen)
|
||||
}
|
||||
if n, err := base32.RawStdEncoding.Decode(buf, k); err == nil {
|
||||
ch <- cid.NewCidV1(cid.Raw, buf[:n])
|
||||
select {
|
||||
case ch <- cid.NewCidV1(cid.Raw, buf[:n]):
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Warnf("failed to decode key %s in badger AllKeysChan; err: %s", k, err)
|
||||
}
|
||||
|
@ -219,6 +219,9 @@ func (s *Suite) TestReopenPutGet(t *testing.T) {
|
||||
fetched, err := bs.Get(orig.Cid())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, orig.RawData(), fetched.RawData())
|
||||
|
||||
err = bs.(io.Closer).Close()
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func (s *Suite) TestPutMany(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user