From 11a8ec06429b639e9fefec85b72a48451acad456 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 20 Oct 2026 02:06:59 +0200 Subject: fix catch-up --- src/compaction/api.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/compaction/api.rs') diff --git a/src/compaction/api.rs b/src/compaction/api.rs index f5c01f2..e55d018 100644 --- a/src/compaction/api.rs +++ b/src/compaction/api.rs @@ -121,9 +121,25 @@ async fn load_report(host: &H, id: &str) -> Option { /// Waits until the compaction leaves `proposed`. Bounded by the proposal's own expiry, /// at which point it is reported as `expired`. async fn wait_until_final(host: &H, id: &str) -> Option { + // A record that was readable may be briefly unreadable or absent while concurrent + // changes merge; give up only if that persists. + const MAX_MISSES: u32 = 5; + let mut changes = host.subscribe_changes(); + let mut seen = false; + let mut misses = 0; loop { - let report = load_report(host, id).await?; + let Some(report) = load_report(host, id).await else { + misses += 1; + warn!(compaction = %id, seen, misses, "Compaction record not readable while waiting"); + if !seen || misses >= MAX_MISSES { + return None; + } + tokio::time::sleep(Duration::from_secs(1)).await; + continue; + }; + seen = true; + misses = 0; if report.phase.is_final() { return Some(report); } -- cgit v1.3.1