Skip to content

Commit

Permalink
Timer::sleep_ms should take ms as u64
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyboyko0791 committed Oct 27, 2022
1 parent c540a24 commit 5c17f3b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mm2src/coins/lightning/ln_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ impl LightningEventHandler {

fn handle_pending_htlcs_forwards(&self, time_forwardable: Duration) {
info!("Handling PendingHTLCsForwardable event!");
let min_wait_time = time_forwardable.as_millis() as u32;
let min_wait_time = time_forwardable.as_millis() as u64;
let channel_manager = self.channel_manager.clone();
self.platform.spawner().spawn(async move {
let millis_to_sleep = rand::thread_rng().gen_range(min_wait_time, min_wait_time * 5);
Expand Down
4 changes: 2 additions & 2 deletions mm2src/common/executor/native_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ impl Timer {
}
}

pub fn sleep_ms(ms: u32) -> Timer {
pub fn sleep_ms(ms: u64) -> Timer {
Timer {
delay: Delay::new(Duration::from_millis(ms as u64)),
delay: Delay::new(Duration::from_millis(ms)),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion mm2src/common/executor/wasm_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl Timer {

pub fn sleep(secs: f64) -> Timer {
let dur = Duration::from_secs_f64(secs);
let delay_ms = gstuff::duration_to_ms(dur) as u32;
let delay_ms = gstuff::duration_to_ms(dur);
Timer::sleep_ms(delay_ms)
}

Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_test_helpers/src/for_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ where
F: Fn(&str) -> bool,
{
let start = now_float();
let ms = 50.min((timeout_sec * 1000.) as u32 / 20 + 10);
let ms = 50.min((timeout_sec * 1000.) as u64 / 20 + 10);
let mut buf = String::with_capacity(128);
let mut found = false;
loop {
Expand Down

0 comments on commit 5c17f3b

Please sign in to comment.