Skip to content

Commit a217998

Browse files
committed
validator_worker - remove heartbeat_time from fn heartbeat and use the SentryApi config property
1 parent 6800252 commit a217998

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

validator_worker/src/follower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub async fn tick<A: Adapter + 'static>(iface: &SentryApi<A>) -> Result<(), Box<
4242
}
4343

4444
// TODO: Pass the heartbeat time from the Configuration
45-
await!(heartbeat(&iface, balances, 250)).map(|_| ())
45+
await!(heartbeat(&iface, balances)).map(|_| ())
4646
}
4747

4848
fn on_new_state<A: Adapter + 'static>(

validator_worker/src/heartbeat.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ async fn send_heartbeat<A: Adapter + 'static>(iface: &SentryApi<A>) -> Result<()
3939
pub async fn heartbeat<A: Adapter + 'static>(
4040
iface: &SentryApi<A>,
4141
balances: BalancesMap,
42-
heartbeat_time: u32,
4342
) -> Result<(), Box<dyn Error>> {
4443
let validator_message_response = await!(iface.get_our_latest_msg("Heartbeat".into()))?;
4544

@@ -53,7 +52,7 @@ pub async fn heartbeat<A: Adapter + 'static>(
5352

5453
let should_send = heartbeat_msg.map_or(true, |heartbeat| {
5554
let duration = Utc::now() - heartbeat.timestamp;
56-
duration > Duration::milliseconds(heartbeat_time.into())
55+
duration > Duration::milliseconds(iface.config.heartbeat_time.into())
5756
&& is_channel_not_exhausted(&iface.channel, &balances)
5857
});
5958

validator_worker/src/leader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub async fn tick<A: Adapter + 'static>(iface: &SentryApi<A>) -> Result<(), Box<
1616
}
1717

1818
// TODO: Pass the heartbeat time from the Configuration
19-
await!(heartbeat(&iface, balances, 250)).map(|_| ())
19+
await!(heartbeat(&iface, balances)).map(|_| ())
2020
}
2121

2222
fn on_new_accounting<A: Adapter + 'static>(

0 commit comments

Comments
 (0)