mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-20 23:21:36 +03:00
kv: close iterator if done
This commit is contained in:
parent
cc0e06598a
commit
cc56a19311
@ -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))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user