More code refactoring to integrate Duration (#8322)
* More code refactoring to integrate Duration * Fix typo * Fix tests * More test fix
This commit is contained in:
committed by
Marek Kotewicz
parent
90eb61091a
commit
fac356c701
@@ -399,7 +399,7 @@ const INFO_TIMER: TimerToken = 0;
|
||||
|
||||
impl<T: InformantData> IoHandler<ClientIoMessage> for Informant<T> {
|
||||
fn initialize(&self, io: &IoContext<ClientIoMessage>) {
|
||||
io.register_timer(INFO_TIMER, 5000).expect("Error registering timer");
|
||||
io.register_timer(INFO_TIMER, Duration::from_secs(5)).expect("Error registering timer");
|
||||
}
|
||||
|
||||
fn timeout(&self, _io: &IoContext<ClientIoMessage>, timer: TimerToken) {
|
||||
|
||||
@@ -35,10 +35,10 @@ use parking_lot::RwLock;
|
||||
|
||||
// Attepmt to cull once every 10 minutes.
|
||||
const TOKEN: TimerToken = 1;
|
||||
const TIMEOUT_MS: u64 = 1000 * 60 * 10;
|
||||
const TIMEOUT: Duration = Duration::from_secs(60 * 10);
|
||||
|
||||
// But make each attempt last only 9 minutes
|
||||
const PURGE_TIMEOUT: Duration = Duration::from_millis(1000 * 60 * 9);
|
||||
const PURGE_TIMEOUT: Duration = Duration::from_secs(60 * 9);
|
||||
|
||||
/// Periodically culls the transaction queue of mined transactions.
|
||||
pub struct QueueCull<T> {
|
||||
@@ -56,7 +56,7 @@ pub struct QueueCull<T> {
|
||||
|
||||
impl<T: LightChainClient + 'static> IoHandler<ClientIoMessage> for QueueCull<T> {
|
||||
fn initialize(&self, io: &IoContext<ClientIoMessage>) {
|
||||
io.register_timer(TOKEN, TIMEOUT_MS).expect("Error registering timer");
|
||||
io.register_timer(TOKEN, TIMEOUT).expect("Error registering timer");
|
||||
}
|
||||
|
||||
fn timeout(&self, _io: &IoContext<ClientIoMessage>, timer: TimerToken) {
|
||||
|
||||
Reference in New Issue
Block a user