From 3e323cbd234d5325981b9ce3c08d0acd8f1eba8b Mon Sep 17 00:00:00 2001 From: ghe0 Date: Thu, 22 Aug 2024 02:14:35 +0300 Subject: [PATCH] improved stability --- src/datastore.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/datastore.rs b/src/datastore.rs index b94bc92..9720577 100644 --- a/src/datastore.rs +++ b/src/datastore.rs @@ -190,16 +190,11 @@ impl Store { /// returns old pubkey if node got updated async fn update_node(&self, ip: String, info: NodeInfo) -> Option { - // if let Some(old_node) = self.nodes.get(&ip) { - // if SystemTime::now() - // .duration_since(old_node.updated_at) - // .unwrap_or(Duration::ZERO) - // .as_secs() - // < 50 - // { - // return None; - // } - // } + if let Some(old_node) = self.nodes.get(&ip) { + if old_node.updated_at > info.updated_at { + return None; + } + } self.nodes.insert(ip, info.clone()) }