mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-02-18 12:43:07 +00:00
make sure we are actually removing closed iterators from pending set
This commit is contained in:
parent
c3b52cd4ec
commit
e357b4bda8
@ -164,6 +164,9 @@ method modify*(
|
||||
if not lock.locked:
|
||||
self.locks.del(key)
|
||||
|
||||
proc openIteratorCount*(self: LevelDbDatastore): int =
|
||||
self.openIterators.len
|
||||
|
||||
proc new*(
|
||||
T: type LevelDbDatastore, dbName: string): ?!T =
|
||||
try:
|
||||
|
||||
@ -195,3 +195,10 @@ suite "LevelDB Query":
|
||||
let iter = (await ds.query(q)).tryGet
|
||||
(await iter.dispose()).tryGet
|
||||
(await iter.dispose()).tryGet
|
||||
|
||||
test "should stop tracking iterator objects once those are disposed":
|
||||
let q = Query.init(Key.init("/a/b/c").tryGet)
|
||||
let iter = (await ds.query(q)).tryGet
|
||||
check ds.openIteratorCount == 1
|
||||
(await iter.dispose()).tryGet
|
||||
check ds.openIteratorCount == 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user