Skip to content

Commit e692179

Browse files
committed
add a little delay to first heartbeat [skip ci]
1 parent bec4749 commit e692179

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compute/src/node/core.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ impl DriaComputeNode {
2424
rpc_liveness_refresh_interval.tick().await; // move each one tick
2525

2626
let mut heartbeat_interval = tokio::time::interval(HEARTBEAT_INTERVAL_SECS);
27+
// move one tick, and wait at least a third of the diagnostics
28+
heartbeat_interval.tick().await;
29+
heartbeat_interval.reset_after(DIAGNOSTIC_REFRESH_INTERVAL_SECS / 3);
2730

2831
loop {
2932
tokio::select! {
@@ -55,6 +58,7 @@ impl DriaComputeNode {
5558
// check RPC, and get a new one if we are disconnected
5659
_ = rpc_liveness_refresh_interval.tick() => self.handle_rpc_liveness_check().await,
5760

61+
// send a heartbeat request to publish liveness info
5862
_ = heartbeat_interval.tick() => {
5963
if let Err(e) = self.send_heartbeat().await {
6064
log::error!("Error making heartbeat: {:?}", e);

0 commit comments

Comments
 (0)