kv: close iterator if done

This commit is contained in:
bitful-pannul 2024-12-20 00:01:25 +02:00
parent cc0e06598a
commit cc56a19311

View File

@ -191,6 +191,16 @@ impl KvState {
}
}
// if we're done, automatically close the iterator
if done {
if let Some(db_iters) = self.iterators.get_mut(&db_key) {
db_iters.remove(&iterator_id);
if db_iters.is_empty() {
self.iterators.remove(&db_key);
}
}
}
Ok((entries, done))
}