Skip to content

Commit 9efc1de

Browse files
authored
Merge pull request #87 from ipfs/fix/query-verify-open
fix: verify that the datastore is still open when querying
2 parents adacbc2 + 390ae7d commit 9efc1de

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

datastore.go

+3
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ func (d *Datastore) Delete(key ds.Key) error {
342342
func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) {
343343
d.closeLk.RLock()
344344
defer d.closeLk.RUnlock()
345+
if d.closed {
346+
return nil, ErrClosed
347+
}
345348

346349
txn := d.newImplicitTransaction(true)
347350
// We cannot defer txn.Discard() here, as the txn must remain active while the iterator is open.

0 commit comments

Comments
 (0)