Skip to content

Commit ee968df

Browse files
committed
change heartbeat deadline duration
1 parent b325461 commit ee968df

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

compute/src/node/core.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use eyre::{eyre, Result};
88
use std::time::Duration;
99
use tokio_util::sync::CancellationToken;
1010

11-
use crate::DriaComputeNode;
11+
use crate::{reqres::HeartbeatRequester, DriaComputeNode};
1212

1313
impl DriaComputeNode {
1414
/// Runs the main loop of the compute node.
@@ -18,8 +18,6 @@ impl DriaComputeNode {
1818
const DIAGNOSTIC_REFRESH_INTERVAL_SECS: Duration = Duration::from_secs(45);
1919
/// Duration between refreshing the available nodes.
2020
const RPC_LIVENESS_REFRESH_INTERVAL_SECS: Duration = Duration::from_secs(2 * 60);
21-
/// Duration between each heartbeat sent to the RPC.
22-
const HEARTBEAT_INTERVAL_SECS: Duration = Duration::from_secs(60);
2321
/// Duration between each specs update sent to the RPC.
2422
const SPECS_INTERVAL_SECS: Duration = Duration::from_secs(60 * 5);
2523

@@ -31,7 +29,7 @@ impl DriaComputeNode {
3129
rpc_liveness_refresh_interval.tick().await; // move each one tick
3230

3331
// move one tick, and wait at least a third of the diagnostics
34-
let mut heartbeat_interval = tokio::time::interval(HEARTBEAT_INTERVAL_SECS);
32+
let mut heartbeat_interval = tokio::time::interval(HeartbeatRequester::HEARTBEAT_DEADLINE);
3533
heartbeat_interval.tick().await;
3634
heartbeat_interval.reset_after(DIAGNOSTIC_REFRESH_INTERVAL_SECS / 3);
3735

compute/src/node/diagnostic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl DriaComputeNode {
2828
"$DRIA Points: {} total, {} earned in this run, within top {}%",
2929
steps.score,
3030
earned,
31-
steps.percentile.unwrap_or("100%".to_string())
31+
steps.percentile.unwrap_or("100".to_string())
3232
));
3333
}
3434

compute/src/reqres/heartbeat.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@ impl IsResponder for HeartbeatRequester {
1919
type Response = HeartbeatResponse;
2020
}
2121

22-
/// Any acknowledged heartbeat that is older than this duration is considered dead.
23-
const HEARTBEAT_DEADLINE_SECS: Duration = Duration::from_secs(20);
24-
2522
impl HeartbeatRequester {
23+
/// Any acknowledged heartbeat that is older than this duration is considered dead.
24+
pub const HEARTBEAT_DEADLINE: Duration = Duration::from_secs(60);
2625
pub(crate) async fn send_heartbeat(
2726
node: &mut DriaComputeNode,
2827
peer_id: PeerId,
2928
) -> Result<OutboundRequestId> {
3029
let uuid = Uuid::now_v7();
31-
let deadline = chrono::Utc::now() + HEARTBEAT_DEADLINE_SECS;
30+
let deadline = chrono::Utc::now() + Self::HEARTBEAT_DEADLINE;
3231

3332
let heartbeat_request = HeartbeatRequest {
3433
heartbeat_id: uuid,

0 commit comments

Comments
 (0)