diff options
author | FxQnLr <[email protected]> | 2024-02-12 15:05:03 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-02-12 15:05:03 +0100 |
commit | ca395b81bcadb9dde9214098f2cab0c7a3561574 (patch) | |
tree | 055bae9ef4e65f53b826b240f0b8e3b15b73693e /src/services/ping.rs | |
parent | e4832b4cf36ba0eaed298ee458498eddd7176590 (diff) | |
parent | e50a868f69b602cc0bc84d51e9940878924f49ef (diff) | |
download | webol-ca395b81bcadb9dde9214098f2cab0c7a3561574.tar webol-ca395b81bcadb9dde9214098f2cab0c7a3561574.tar.gz webol-ca395b81bcadb9dde9214098f2cab0c7a3561574.zip |
Merge pull request #13 from FxQnLr/config
Config
Diffstat (limited to 'src/services/ping.rs')
-rw-r--r-- | src/services/ping.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/services/ping.rs b/src/services/ping.rs index 7d71218..9b164c8 100644 --- a/src/services/ping.rs +++ b/src/services/ping.rs | |||
@@ -10,7 +10,7 @@ use time::{Duration, Instant}; | |||
10 | use tokio::sync::broadcast::Sender; | 10 | use tokio::sync::broadcast::Sender; |
11 | use tracing::{debug, error, trace}; | 11 | use tracing::{debug, error, trace}; |
12 | use crate::AppState; | 12 | use crate::AppState; |
13 | use crate::config::SETTINGS; | 13 | use crate::config::Config; |
14 | use crate::db::Device; | 14 | use crate::db::Device; |
15 | 15 | ||
16 | pub type StatusMap = DashMap<String, Value>; | 16 | pub type StatusMap = DashMap<String, Value>; |
@@ -21,7 +21,7 @@ pub struct Value { | |||
21 | pub online: bool | 21 | pub online: bool |
22 | } | 22 | } |
23 | 23 | ||
24 | pub async fn spawn(tx: Sender<BroadcastCommands>, device: Device, uuid: String, ping_map: &StatusMap, db: &PgPool) { | 24 | pub async fn spawn(tx: Sender<BroadcastCommands>, config: &Config, device: Device, uuid: String, ping_map: &StatusMap, db: &PgPool) { |
25 | let timer = Instant::now(); | 25 | let timer = Instant::now(); |
26 | let payload = [0; 8]; | 26 | let payload = [0; 8]; |
27 | 27 | ||
@@ -40,7 +40,7 @@ pub async fn spawn(tx: Sender<BroadcastCommands>, device: Device, uuid: String, | |||
40 | error!("{}", ping.to_string()); | 40 | error!("{}", ping.to_string()); |
41 | msg = Some(BroadcastCommands::Error(uuid.clone())); | 41 | msg = Some(BroadcastCommands::Error(uuid.clone())); |
42 | } | 42 | } |
43 | if timer.elapsed() >= Duration::minutes(SETTINGS.get_int("pingtimeout").unwrap_or(10)) { | 43 | if timer.elapsed() >= Duration::minutes(config.pingtimeout) { |
44 | msg = Some(BroadcastCommands::Timeout(uuid.clone())); | 44 | msg = Some(BroadcastCommands::Timeout(uuid.clone())); |
45 | } | 45 | } |
46 | } else { | 46 | } else { |