@@ -9,22 +9,21 @@ impl DriaComputeNode {
9
9
/// Runs the main loop of the compute node.
10
10
/// This method is not expected to return until cancellation occurs for the given token.
11
11
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
+
20
19
let mut diagnostic_refresh_interval =
21
- tokio:: time:: interval ( Duration :: from_secs ( DIAGNOSTIC_REFRESH_INTERVAL_SECS ) ) ;
20
+ tokio:: time:: interval ( DIAGNOSTIC_REFRESH_INTERVAL_SECS ) ;
22
21
diagnostic_refresh_interval. tick ( ) . await ; // move each one tick
23
22
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 ) ;
25
24
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 ) ;
28
27
29
28
loop {
30
29
tokio:: select! {
0 commit comments