make sure we are actually removing closed iterators from pending set

This commit is contained in:
gmega 2026-02-09 09:52:58 -03:00
parent c3b52cd4ec
commit e357b4bda8
No known key found for this signature in database
GPG Key ID: 6290D34EAD824B18
2 changed files with 10 additions and 0 deletions

View File

@ -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:

View File

@ -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