diff options
Diffstat (limited to 'src/client/connector.rs')
| -rw-r--r-- | src/client/connector.rs | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/client/connector.rs b/src/client/connector.rs index 735a3d3..a595c8e 100644 --- a/src/client/connector.rs +++ b/src/client/connector.rs @@ -42,9 +42,12 @@ pub trait Connection { } fn tick(&mut self) { - // tradeoff: if I put this at the ened of the loop, then the continue would just skip it, and continue doing update() until with no waiting, this wastes lot of cpu/IO - // however, of course we can add a manual sleep before it continue and put this in the end, but that's code duplication - // the cons of the current approch is that the first time we've entered, it would start sleeping + // tradeoff: if I put this at the ened of the loop, then the continue would just + // skip it, and continue doing update() until with no waiting, this wastes lot + // of cpu/IO however, of course we can add a manual sleep before it + // continue and put this in the end, but that's code duplication + // the cons of the current approch is that the first time we've entered, it + // would start sleeping self.reinit(); match self.update() { @@ -59,26 +62,11 @@ pub trait Connection { None => return, }; // FIXME: handle the errors... peak prod code - self.ntfy( - Executor::new(task, it.map(str::to_string)) - .unwrap() - .run() - .unwrap() - .clone() - .unwrap(), - ) - .unwrap(); + self.ntfy(Executor::new(task, it.map(str::to_string)).unwrap().run().unwrap().clone().unwrap()).unwrap(); } Result::Err(e) => { #[cfg(debug_assertions)] - std::eprintln!( - "[{}:{}:{}] {} = {:#?}", - std::file!(), - std::line!(), - std::column!(), - std::stringify!(e), - &&e as &dyn std::fmt::Debug, - ); + std::eprintln!("[{}:{}:{}] {} = {:#?}", std::file!(), std::line!(), std::column!(), std::stringify!(e), &&e as &dyn std::fmt::Debug,); } } } |
