From 453b20be0ad5b01e0df552e07d7ede110ebcdea5 Mon Sep 17 00:00:00 2001 From: tmcgroul Date: Sun, 25 Aug 2024 19:44:12 +0700 Subject: [PATCH] fix panic in get_worker --- crates/router-controller/src/controller.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/router-controller/src/controller.rs b/crates/router-controller/src/controller.rs index e59a95b..eb7b4d0 100644 --- a/crates/router-controller/src/controller.rs +++ b/crates/router-controller/src/controller.rs @@ -100,8 +100,10 @@ impl Controller { if info.suspended { return None } - if now.duration_since(info.last_ping).unwrap() > Duration::from_secs(30) { - return None + if let Ok(duration) = now.duration_since(info.last_ping) { + if duration > Duration::from_secs(30) { + return None + } } if info.state.get(dataset).map_or(false, |ranges| ranges.has(first_block)) { Some(info)