Skip to content

Commit

Permalink
Use from_secs api to create duration (#27222)
Browse files Browse the repository at this point in the history
use from_secs api to create duration
  • Loading branch information
HaoranYi authored Aug 18, 2022
1 parent 77563bc commit 4634fb9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gossip/tests/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ where
} else {
trace!("not converged {} {} {}", i, total + num, num * num);
}
sleep(Duration::new(1, 0));
sleep(Duration::from_secs(1));
}
exit.store(true, Ordering::Relaxed);
for (_, dr, _) in listen {
Expand Down Expand Up @@ -251,7 +251,7 @@ pub fn cluster_info_retransmit() {
if done {
break;
}
sleep(Duration::new(1, 0));
sleep(Duration::from_secs(1));
}
assert!(done);
let mut p = Packet::default();
Expand All @@ -269,7 +269,7 @@ pub fn cluster_info_retransmit() {
.into_par_iter()
.map(|s| {
let mut p = Packet::default();
s.set_read_timeout(Some(Duration::new(1, 0))).unwrap();
s.set_read_timeout(Some(Duration::from_secs(1))).unwrap();
let res = s.recv_from(p.buffer_mut());
res.is_err() //true if failed to receive the retransmit packet
})
Expand Down
2 changes: 1 addition & 1 deletion ledger/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5005,7 +5005,7 @@ pub mod tests {
blockstore
.insert_shreds(vec![shreds.remove(1)], None, false)
.unwrap();
let timer = Duration::new(1, 0);
let timer = Duration::from_secs(1);
assert!(recvr.recv_timeout(timer).is_err());
// Insert first shred, now we've made a consecutive block
blockstore
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12977,7 +12977,7 @@ pub(crate) mod tests {
#[cfg(not(target_os = "linux"))]
{
error!("{} banks, sleeping for 5 sec", num_banks);
std::thread::sleep(Duration::new(5, 0));
std::thread::sleep(Duration::from_secs(5));
}
}
}
Expand Down

0 comments on commit 4634fb9

Please sign in to comment.