Skip to content

Commit 7d8343f

Browse files
committed
decrease available node refresh time
1 parent 0fbdb6e commit 7d8343f

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

compute/src/node/core.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@ impl DriaComputeNode {
99
/// Runs the main loop of the compute node.
1010
/// This method is not expected to return until cancellation occurs for the given token.
1111
pub async fn run(&mut self, cancellation: CancellationToken) {
12-
/// Number of seconds between refreshing for diagnostic prints.
13-
const DIAGNOSTIC_REFRESH_INTERVAL_SECS: u64 = 30;
14-
/// Number of seconds between refreshing the available nodes.
15-
const AVAILABLE_NODES_REFRESH_INTERVAL_SECS: u64 = 10 * 60;
16-
/// Number of seconds between each heartbeat sent to the RPC.
17-
const HEARTBEAT_INTERVAL_SECS: u64 = 60;
18-
19-
// prepare durations for sleeps
12+
/// Duration between refreshing for diagnostic prints.
13+
const DIAGNOSTIC_REFRESH_INTERVAL_SECS: Duration = Duration::from_secs(30);
14+
/// Duration between refreshing the available nodes.
15+
const AVAILABLE_NODES_REFRESH_INTERVAL_SECS: Duration = Duration::from_secs(2 * 60);
16+
/// Duration between each heartbeat sent to the RPC.
17+
const HEARTBEAT_INTERVAL_SECS: Duration = Duration::from_secs(60);
18+
2019
let mut diagnostic_refresh_interval =
21-
tokio::time::interval(Duration::from_secs(DIAGNOSTIC_REFRESH_INTERVAL_SECS));
20+
tokio::time::interval(DIAGNOSTIC_REFRESH_INTERVAL_SECS);
2221
diagnostic_refresh_interval.tick().await; // move each one tick
2322
let mut available_node_refresh_interval =
24-
tokio::time::interval(Duration::from_secs(AVAILABLE_NODES_REFRESH_INTERVAL_SECS));
23+
tokio::time::interval(AVAILABLE_NODES_REFRESH_INTERVAL_SECS);
2524
available_node_refresh_interval.tick().await; // move each one tick
26-
let mut heartbeat_interval =
27-
tokio::time::interval(Duration::from_secs(HEARTBEAT_INTERVAL_SECS));
25+
26+
let mut heartbeat_interval = tokio::time::interval(HEARTBEAT_INTERVAL_SECS);
2827

2928
loop {
3029
tokio::select! {

0 commit comments

Comments
 (0)