Skip to content

Commit 24004e8

Browse files
chore: Provide heartbeat retries in config (#614)
* chore: Provide hearbeat retries in config * fmt
1 parent 7f8bd5f commit 24004e8

File tree

6 files changed

+18
-3
lines changed

6 files changed

+18
-3
lines changed

deploy/prod/common-values-iris-mpc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
image: "ghcr.io/worldcoin/iris-mpc:v0.8.34"
1+
image: "ghcr.io/worldcoin/iris-mpc:v0.8.35"
22

33
environment: prod
44
replicaCount: 1

deploy/prod/smpcv2-0-prod/values-iris-mpc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ env:
5656
- name: SMPC__HEARTBEAT_INTERVAL_SECS
5757
value: "2"
5858

59+
- name: SMPC__HEARTBEAT_INITIAL_RETRIES
60+
value: "50"
61+
5962
- name: SMPC__PATH
6063
value: "/data/"
6164

deploy/prod/smpcv2-1-prod/values-iris-mpc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ env:
5656
- name: SMPC__HEARTBEAT_INTERVAL_SECS
5757
value: "2"
5858

59+
- name: SMPC__HEARTBEAT_INITIAL_RETRIES
60+
value: "50"
61+
5962
- name: SMPC__PATH
6063
value: "/data/"
6164

deploy/prod/smpcv2-2-prod/values-iris-mpc.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ env:
5656
- name: SMPC__HEARTBEAT_INTERVAL_SECS
5757
value: "2"
5858

59+
- name: SMPC__HEARTBEAT_INITIAL_RETRIES
60+
value: "50"
61+
5962
- name: SMPC__PATH
6063
value: "/data/"
6164

iris-mpc-common/src/config/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ pub struct Config {
6464
#[serde(default = "default_heartbeat_interval_secs")]
6565
pub heartbeat_interval_secs: u64,
6666

67+
#[serde(default = "default_heartbeat_initial_retries")]
68+
pub heartbeat_initial_retries: u64,
69+
6770
#[serde(default)]
6871
pub fake_db_size: usize,
6972

@@ -89,6 +92,10 @@ fn default_heartbeat_interval_secs() -> u64 {
8992
30
9093
}
9194

95+
fn default_heartbeat_initial_retries() -> u64 {
96+
10
97+
}
98+
9299
impl Config {
93100
pub fn load_config(prefix: &str) -> eyre::Result<Config> {
94101
let settings = config::Config::builder();

iris-mpc/src/bin/server.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ const REGION: &str = "eu-north-1";
5454
const RNG_SEED_INIT_DB: u64 = 42;
5555
const SQS_POLLING_INTERVAL: Duration = Duration::from_secs(1);
5656
const MAX_CONCURRENT_REQUESTS: usize = 32;
57-
const HEARTBEAT_INITIAL_RETRIES: usize = 5;
5857

5958
static CURRENT_BATCH_SIZE: LazyLock<Mutex<usize>> = LazyLock::new(|| Mutex::new(0));
6059

@@ -976,7 +975,7 @@ async fn server_main(config: Config) -> eyre::Result<()> {
976975
// If it's the first time after startup, we allow a few retries to let the other
977976
// nodes start up as well.
978977
if last_response[i] == String::default()
979-
&& retries[i] < HEARTBEAT_INITIAL_RETRIES
978+
&& retries[i] < config.heartbeat_initial_retries
980979
{
981980
retries[i] += 1;
982981
tracing::warn!("Node {} did not respond with success, retrying...", host);

0 commit comments

Comments
 (0)