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
@@ -18,6 +18,7 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::path::Path;
|
||||
use std::time::Duration;
|
||||
|
||||
use ansi_term::Colour;
|
||||
use io::{IoContext, TimerToken, IoHandler, IoService, IoError};
|
||||
@@ -180,13 +181,13 @@ struct ClientIoHandler {
|
||||
const CLIENT_TICK_TIMER: TimerToken = 0;
|
||||
const SNAPSHOT_TICK_TIMER: TimerToken = 1;
|
||||
|
||||
const CLIENT_TICK_MS: u64 = 5000;
|
||||
const SNAPSHOT_TICK_MS: u64 = 10000;
|
||||
const CLIENT_TICK: Duration = Duration::from_secs(5);
|
||||
const SNAPSHOT_TICK: Duration = Duration::from_secs(10);
|
||||
|
||||
impl IoHandler<ClientIoMessage> for ClientIoHandler {
|
||||
fn initialize(&self, io: &IoContext<ClientIoMessage>) {
|
||||
io.register_timer(CLIENT_TICK_TIMER, CLIENT_TICK_MS).expect("Error registering client timer");
|
||||
io.register_timer(SNAPSHOT_TICK_TIMER, SNAPSHOT_TICK_MS).expect("Error registering snapshot timer");
|
||||
io.register_timer(CLIENT_TICK_TIMER, CLIENT_TICK).expect("Error registering client timer");
|
||||
io.register_timer(SNAPSHOT_TICK_TIMER, SNAPSHOT_TICK).expect("Error registering snapshot timer");
|
||||
}
|
||||
|
||||
fn timeout(&self, _io: &IoContext<ClientIoMessage>, timer: TimerToken) {
|
||||
|
||||
Reference in New Issue
Block a user