From e22f5acb11c52535af82546cefaae32eeb5790f0 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Fri, 24 Apr 2026 18:25:07 +0300 Subject: [PATCH] fix: check batches count on resize waiting --- store/src/lmdb.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/store/src/lmdb.rs b/store/src/lmdb.rs index 4463fb98..7b7f5f9a 100644 --- a/store/src/lmdb.rs +++ b/store/src/lmdb.rs @@ -322,12 +322,15 @@ impl Store { } debug!("Start resizing {} DB", self.name); unsafe { - let batches_count = - ENV_BATCHES_COUNT.get_or_init(|| Arc::new(RwLock::new(HashMap::new()))); - let batches = batches_count.write(); - let cur = batches.get(&self.env_path).unwrap_or(&0); - debug!("Wait {} batches to complete", cur); - while cur != &0 { + loop { + let batches_count = + ENV_BATCHES_COUNT.get_or_init(|| Arc::new(RwLock::new(HashMap::new()))); + let batches = batches_count.read(); + let cur = batches.get(&self.env_path).unwrap_or(&0); + if cur == &0 { + break; + } + debug!("Wait {} batches to complete", cur); thread::sleep(Duration::from_millis(100)); } self.env.resize(new_size)?;