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};
8
8
use std:: time:: Duration ;
9
9
use tokio_util:: sync:: CancellationToken ;
10
10
11
- use crate :: DriaComputeNode ;
11
+ use crate :: { reqres :: HeartbeatRequester , DriaComputeNode } ;
12
12
13
13
impl DriaComputeNode {
14
14
/// Runs the main loop of the compute node.
@@ -18,8 +18,6 @@ impl DriaComputeNode {
18
18
const DIAGNOSTIC_REFRESH_INTERVAL_SECS : Duration = Duration :: from_secs ( 45 ) ;
19
19
/// Duration between refreshing the available nodes.
20
20
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 ) ;
23
21
/// Duration between each specs update sent to the RPC.
24
22
const SPECS_INTERVAL_SECS : Duration = Duration :: from_secs ( 60 * 5 ) ;
25
23
@@ -31,7 +29,7 @@ impl DriaComputeNode {
31
29
rpc_liveness_refresh_interval. tick ( ) . await ; // move each one tick
32
30
33
31
// 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 ) ;
35
33
heartbeat_interval. tick ( ) . await ;
36
34
heartbeat_interval. reset_after ( DIAGNOSTIC_REFRESH_INTERVAL_SECS / 3 ) ;
37
35
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ impl DriaComputeNode {
28
28
"$DRIA Points: {} total, {} earned in this run, within top {}%" ,
29
29
steps. score,
30
30
earned,
31
- steps. percentile. unwrap_or( "100% " . to_string( ) )
31
+ steps. percentile. unwrap_or( "100" . to_string( ) )
32
32
) ) ;
33
33
}
34
34
Original file line number Diff line number Diff line change @@ -19,16 +19,15 @@ impl IsResponder for HeartbeatRequester {
19
19
type Response = HeartbeatResponse ;
20
20
}
21
21
22
- /// Any acknowledged heartbeat that is older than this duration is considered dead.
23
- const HEARTBEAT_DEADLINE_SECS : Duration = Duration :: from_secs ( 20 ) ;
24
-
25
22
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 ) ;
26
25
pub ( crate ) async fn send_heartbeat (
27
26
node : & mut DriaComputeNode ,
28
27
peer_id : PeerId ,
29
28
) -> Result < OutboundRequestId > {
30
29
let uuid = Uuid :: now_v7 ( ) ;
31
- let deadline = chrono:: Utc :: now ( ) + HEARTBEAT_DEADLINE_SECS ;
30
+ let deadline = chrono:: Utc :: now ( ) + Self :: HEARTBEAT_DEADLINE ;
32
31
33
32
let heartbeat_request = HeartbeatRequest {
34
33
heartbeat_id : uuid,
You can’t perform that action at this time.
0 commit comments