fix potential panic with max readers retry and cursor channel

This commit is contained in:
vyzo 2021-02-01 18:39:50 +02:00
parent b9f8a3d587
commit d91b60df91

View File

@ -131,10 +131,11 @@ func (s *trackingStore) Delete(cid cid.Cid) error {
func (s *trackingStore) Keys(ctx context.Context) (<-chan cid.Cid, error) {
ch := make(chan cid.Cid)
go func() {
defer close(ch)
err := withMaxReadersRetry(
func() error {
return s.env.View(func(txn *lmdb.Txn) error {
defer close(ch)
txn.RawRead = true
cur, err := txn.OpenCursor(s.db)