diff --git a/src/channels/mod.rs b/src/channels/mod.rs index 8670116..3f4b37a 100644 --- a/src/channels/mod.rs +++ b/src/channels/mod.rs @@ -56,6 +56,8 @@ fn spawn_supervised_listener( Ok(()) => { tracing::warn!("Channel {} exited unexpectedly; restarting", ch.name()); crate::health::mark_component_error(&component, "listener exited unexpectedly"); + // Clean exit — reset backoff since the listener ran successfully + backoff = initial_backoff_secs.max(1); } Err(e) => { tracing::error!("Channel {} error: {e}; restarting", ch.name()); @@ -65,6 +67,7 @@ fn spawn_supervised_listener( crate::health::bump_component_restart(&component); tokio::time::sleep(Duration::from_secs(backoff)).await; + // Double backoff AFTER sleeping so first error uses initial_backoff backoff = backoff.saturating_mul(2).min(max_backoff); } }) diff --git a/src/daemon/mod.rs b/src/daemon/mod.rs index e2b3e2c..2845a17 100644 --- a/src/daemon/mod.rs +++ b/src/daemon/mod.rs @@ -153,6 +153,8 @@ where Ok(()) => { crate::health::mark_component_error(name, "component exited unexpectedly"); tracing::warn!("Daemon component '{name}' exited unexpectedly"); + // Clean exit — reset backoff since the component ran successfully + backoff = initial_backoff_secs.max(1); } Err(e) => { crate::health::mark_component_error(name, e.to_string()); @@ -162,6 +164,7 @@ where crate::health::bump_component_restart(name); tokio::time::sleep(Duration::from_secs(backoff)).await; + // Double backoff AFTER sleeping so first error uses initial_backoff backoff = backoff.saturating_mul(2).min(max_backoff); } })