Skip to content
Prev Previous commit
Next Next commit
change timeout after try tick true
  • Loading branch information
maciejnems committed Dec 28, 2022
commit ab8954c2604ad01b9c1b88f5c7ede614ea486bf6
2 changes: 2 additions & 0 deletions finality-aleph/src/sync/ticker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ impl Ticker {
let now = Instant::now();
if now.saturating_duration_since(self.last_tick) >= self.min_timeout {
self.last_tick = now;
self.current_timeout = self.min_timeout;
true
} else {
self.current_timeout = self.min_timeout;
Expand Down Expand Up @@ -82,6 +83,7 @@ mod tests {
async fn wait_after_try_tick_true() {
let mut ticker = setup_ticker();

assert!(!ticker.try_tick());
sleep(MIN_TIMEOUT).await;
assert!(ticker.try_tick());

Expand Down