Implement exponential backoff for resync retries

This commit is contained in:
Alex Auvolat
2022-02-25 20:42:56 +01:00
parent bfb4353df5
commit fe62d01b7e
3 changed files with 106 additions and 5 deletions
+8
View File
@@ -52,6 +52,14 @@ impl SledCountedTree {
res
}
pub fn remove<K: AsRef<[u8]>>(&self, key: K) -> Result<Option<IVec>> {
let res = self.0.tree.remove(key);
if matches!(res, Ok(Some(_))) {
self.0.len.fetch_sub(1, Ordering::Relaxed);
}
res
}
pub fn pop_min(&self) -> Result<Option<(IVec, IVec)>> {
let res = self.0.tree.pop_min();
if let Ok(Some(_)) = &res {