Skip to content

Commit

Permalink
fix issue with too small sleep time
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Oct 25, 2023
1 parent 84941d5 commit f75d7a6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/erc20_payment_lib/src/sender/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ pub async fn service_loop(
(next_gather_time - current_time).num_seconds() as u64
))
);
tokio::time::sleep(Duration::from_secs(std::cmp::min(
payment_setup.report_alive_interval,
(next_gather_time - current_time).num_seconds() as u64,
)))
tokio::time::sleep(Duration::from_secs_f64(
(payment_setup.report_alive_interval as f64)
.min((next_gather_time - current_time).num_milliseconds() as f64 / 1000.0),
))
.await;
continue;
}
Expand Down

0 comments on commit f75d7a6

Please sign in to comment.