Unverified Commit 9efc1de4 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #87 from ipfs/fix/query-verify-open

fix: verify that the datastore is still open when querying
parents adacbc25 390ae7d9
......@@ -342,6 +342,9 @@ func (d *Datastore) Delete(key ds.Key) error {
func (d *Datastore) Query(q dsq.Query) (dsq.Results, error) {
d.closeLk.RLock()
defer d.closeLk.RUnlock()
if d.closed {
return nil, ErrClosed
}
txn := d.newImplicitTransaction(true)
// We cannot defer txn.Discard() here, as the txn must remain active while the iterator is open.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment