File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed
Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use eyre::{eyre, Result};
88use std:: time:: Duration ;
99use tokio_util:: sync:: CancellationToken ;
1010
11- use crate :: DriaComputeNode ;
11+ use crate :: { reqres :: HeartbeatRequester , DriaComputeNode } ;
1212
1313impl 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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-
2522impl 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,
You can’t perform that action at this time.
0 commit comments