From afdf169b5581c468c2d430be6b613ffc05d85eb4 Mon Sep 17 00:00:00 2001 From: hnidoaht-101 <101930794+hnidoaht-101@users.noreply.github.com> Date: Thu, 18 Aug 2022 11:19:46 +0700 Subject: [PATCH] fix(base_node_config): check_interva l is 0 made base node is panicked --- base_layer/p2p/src/auto_update/service.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/base_layer/p2p/src/auto_update/service.rs b/base_layer/p2p/src/auto_update/service.rs index 8bed655a91..03c74f9803 100644 --- a/base_layer/p2p/src/auto_update/service.rs +++ b/base_layer/p2p/src/auto_update/service.rs @@ -20,7 +20,7 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::env::consts; +use std::{env::consts, time::Duration}; use futures::{future::Either, stream, StreamExt}; use log::*; @@ -93,7 +93,11 @@ impl SoftwareUpdaterService { notifier: watch::Sender>, new_update_notification: watch::Receiver>, ) { - let mut interval_or_never = match self.config.check_interval { + let mut config_interval = self.config.check_interval; + if Duration::from_secs(self.config.check_interval.unwrap_or_default().as_secs()).is_zero() { + config_interval = None; + } + let mut interval_or_never = match config_interval { Some(interval) => { let mut interval = time::interval(interval); interval.set_missed_tick_behavior(MissedTickBehavior::Skip);