diff options
author | fxqnlr <[email protected]> | 2024-06-13 16:54:35 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2024-06-13 16:54:35 +0200 |
commit | c124f9fff690a42ea5fb490e4c7e512ba8448951 (patch) | |
tree | f17edd2042d2dc713f3dd6b0bdabbbb2444fc863 /src/services/ping.rs | |
parent | 04cd0aee6d000073e49b80a530a40cdb176f7f10 (diff) | |
download | webol-c124f9fff690a42ea5fb490e4c7e512ba8448951.tar webol-c124f9fff690a42ea5fb490e4c7e512ba8448951.tar.gz webol-c124f9fff690a42ea5fb490e4c7e512ba8448951.zip |
cargo update + `time` update, fix for `Instant` deprecation
Diffstat (limited to 'src/services/ping.rs')
-rw-r--r-- | src/services/ping.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/services/ping.rs b/src/services/ping.rs index 4e0ffcf..69c911f 100644 --- a/src/services/ping.rs +++ b/src/services/ping.rs | |||
@@ -2,8 +2,8 @@ use crate::config::Config; | |||
2 | use crate::storage::Device; | 2 | use crate::storage::Device; |
3 | use dashmap::DashMap; | 3 | use dashmap::DashMap; |
4 | use ipnetwork::IpNetwork; | 4 | use ipnetwork::IpNetwork; |
5 | use std::fmt::Display; | 5 | use std::{fmt::Display, time::Instant}; |
6 | use time::{Duration, Instant}; | 6 | use time::Duration; |
7 | use tokio::sync::broadcast::Sender; | 7 | use tokio::sync::broadcast::Sender; |
8 | use tracing::{debug, error, trace}; | 8 | use tracing::{debug, error, trace}; |
9 | 9 | ||
@@ -12,7 +12,7 @@ pub type StatusMap = DashMap<String, Value>; | |||
12 | #[derive(Debug, Clone)] | 12 | #[derive(Debug, Clone)] |
13 | pub struct Value { | 13 | pub struct Value { |
14 | pub ip: IpNetwork, | 14 | pub ip: IpNetwork, |
15 | pub eta: i64, | 15 | pub eta: u64, |
16 | pub online: bool, | 16 | pub online: bool, |
17 | } | 17 | } |
18 | 18 | ||
@@ -56,12 +56,12 @@ pub async fn spawn( | |||
56 | 56 | ||
57 | let _ = tx.send(msg.clone()); | 57 | let _ = tx.send(msg.clone()); |
58 | if msg.command == BroadcastCommands::Success { | 58 | if msg.command == BroadcastCommands::Success { |
59 | if timer.elapsed().whole_seconds() > config.pingthreshold { | 59 | if timer.elapsed().as_secs() > config.pingthreshold { |
60 | let newtimes = if let Some(mut oldtimes) = device.times { | 60 | let newtimes = if let Some(mut oldtimes) = device.times { |
61 | oldtimes.push(timer.elapsed().whole_seconds()); | 61 | oldtimes.push(timer.elapsed().as_secs()); |
62 | oldtimes | 62 | oldtimes |
63 | } else { | 63 | } else { |
64 | vec![timer.elapsed().whole_seconds()] | 64 | vec![timer.elapsed().as_secs()] |
65 | }; | 65 | }; |
66 | 66 | ||
67 | let updatedev = Device { | 67 | let updatedev = Device { |