From a44933ac577093c1079d7a34d55d3eb3547a0db7 Mon Sep 17 00:00:00 2001 From: hnidoaht-101 <101930794+hnidoaht-101@users.noreply.github.com> Date: Thu, 18 Aug 2022 12:27:31 +0700 Subject: [PATCH] fix(base_node_config): check_interval is 0 made base node is panicked --- base_layer/p2p/src/auto_update/service.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/base_layer/p2p/src/auto_update/service.rs b/base_layer/p2p/src/auto_update/service.rs index 8bed655a91..b7b3e761fb 100644 --- a/base_layer/p2p/src/auto_update/service.rs +++ b/base_layer/p2p/src/auto_update/service.rs @@ -95,9 +95,13 @@ impl SoftwareUpdaterService { ) { let mut interval_or_never = match self.config.check_interval { Some(interval) => { - let mut interval = time::interval(interval); - interval.set_missed_tick_behavior(MissedTickBehavior::Skip); - Either::Left(wrappers::IntervalStream::new(interval)) + if interval.is_zero() { + Either::Right(stream::empty()) + } else { + let mut interval = time::interval(interval); + interval.set_missed_tick_behavior(MissedTickBehavior::Skip); + Either::Left(wrappers::IntervalStream::new(interval)) + } }, None => Either::Right(stream::empty()), };