From 8b0953624f7f6b2ffdf447df6bc6bd70f818edac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Fri, 16 Feb 2024 17:39:22 +0000 Subject: [PATCH] being less aggressive in contract polling --- nym-api/src/coconut/dkg/controller/mod.rs | 5 +++++ nym-api/src/support/config/mod.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/nym-api/src/coconut/dkg/controller/mod.rs b/nym-api/src/coconut/dkg/controller/mod.rs index 4b35fb3fcf..db9ce0a82c 100644 --- a/nym-api/src/coconut/dkg/controller/mod.rs +++ b/nym-api/src/coconut/dkg/controller/mod.rs @@ -191,6 +191,11 @@ impl DkgController { self.state.in_progress_state_mut(epoch_id).unwrap().entered = true; } + // so at this point we don't need to be polling the contract so often anymore, but we can't easily + // adjust the existing interval. + // however, what we can do is just wait here for a bit each iteration + tokio::time::sleep(Duration::from_secs(120)).await; + Ok(()) } diff --git a/nym-api/src/support/config/mod.rs b/nym-api/src/support/config/mod.rs index ca2eb1328c..c5191b7960 100644 --- a/nym-api/src/support/config/mod.rs +++ b/nym-api/src/support/config/mod.rs @@ -30,7 +30,7 @@ mod upgrade_helpers; pub const DEFAULT_LOCAL_VALIDATOR: &str = "http://localhost:26657"; -pub const DEFAULT_DKG_CONTRACT_POLLING_RATE: Duration = Duration::from_secs(10); +pub const DEFAULT_DKG_CONTRACT_POLLING_RATE: Duration = Duration::from_secs(30); const DEFAULT_GATEWAY_SENDING_RATE: usize = 200; const DEFAULT_MAX_CONCURRENT_GATEWAY_CLIENTS: usize = 50;