From 007b7ddccb8096c664374cced0d2adfe0c0819e4 Mon Sep 17 00:00:00 2001 From: Santiago Carmuega Date: Sun, 13 Oct 2024 15:52:53 -0300 Subject: [PATCH] fix: use saturating substract in housekeeping logic --- src/wal/redb.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wal/redb.rs b/src/wal/redb.rs index 09f78b22..e7da3560 100644 --- a/src/wal/redb.rs +++ b/src/wal/redb.rs @@ -249,8 +249,8 @@ impl WalStore { } }; - let delta = last_slot - start_slot; - let excess = delta - max_slots; + let delta = last_slot.saturating_sub(start_slot); + let excess = delta.saturating_sub(max_slots); debug!( delta,