fix potential panic with max readers retry and cursor channel
This commit is contained in:
parent
b9f8a3d587
commit
d91b60df91
@ -131,10 +131,11 @@ func (s *trackingStore) Delete(cid cid.Cid) error {
|
|||||||
func (s *trackingStore) Keys(ctx context.Context) (<-chan cid.Cid, error) {
|
func (s *trackingStore) Keys(ctx context.Context) (<-chan cid.Cid, error) {
|
||||||
ch := make(chan cid.Cid)
|
ch := make(chan cid.Cid)
|
||||||
go func() {
|
go func() {
|
||||||
|
defer close(ch)
|
||||||
|
|
||||||
err := withMaxReadersRetry(
|
err := withMaxReadersRetry(
|
||||||
func() error {
|
func() error {
|
||||||
return s.env.View(func(txn *lmdb.Txn) error {
|
return s.env.View(func(txn *lmdb.Txn) error {
|
||||||
defer close(ch)
|
|
||||||
|
|
||||||
txn.RawRead = true
|
txn.RawRead = true
|
||||||
cur, err := txn.OpenCursor(s.db)
|
cur, err := txn.OpenCursor(s.db)
|
||||||
|
Loading…
Reference in New Issue
Block a user