From 0e6669f6170c4e244b9b3b951d12c1155a6f9be0 Mon Sep 17 00:00:00 2001 From: phiresky Date: Thu, 4 Jan 2024 19:28:26 +0100 Subject: [PATCH] no endless loop if queue too recent (#4349) --- crates/federate/src/worker.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index 6dff325b6..e9e5fb708 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -152,7 +152,15 @@ impl InstanceWorker { self.save_and_send_state(pool).await?; latest_id }; - if id == latest_id { + if id >= latest_id { + if id > latest_id { + tracing::error!( + "{}: last successful id {} is higher than latest id {} in database (did the db get cleared?)", + self.instance.domain, + id.0, + latest_id.0 + ); + } // no more work to be done, wait before rechecking tokio::select! { () = sleep(*WORK_FINISHED_RECHECK_DELAY) => {},