Merge pull request 'add config delay' (#41) from feature/device-out into rc
test-org/integration-module/pipeline/pr-master Build succeeded

Reviewed-on: http://git.enode/deployer3000/integration-module/pulls/41
pull/42/head
Vladislav Drozdov 2025-06-06 16:01:39 +03:00
commit 5de11c05ff
3 changed files with 12 additions and 3 deletions

View File

@ -31,3 +31,6 @@ IM_LOG_INFO = "INFO"
# IM configuration for setting up API connetion # IM configuration for setting up API connetion
# timeout (in secs). Default value - 10 # timeout (in secs). Default value - 10
IM_CONNECTION_TIMEOUT = "10" IM_CONNECTION_TIMEOUT = "10"
# IM configuration for delay of requests
# delay (in secs). Default value - 5
IM_REQUEST_DELAY = "20"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "api-grub" name = "api-grub"
version = "1.0.11" version = "1.0.15"
edition = "2021" edition = "2021"
authors = ["Vladislav Drozdov <maseeeeeeeed@gmail.com>"] authors = ["Vladislav Drozdov <maseeeeeeeed@gmail.com>"]
description = "API poller for ZVKS project" description = "API poller for ZVKS project"

View File

@ -36,10 +36,16 @@ async fn main() -> Result<()>{
}, },
} }
}); });
let request_delay = std::env::var("IM_REQUEST_DELAY")
.unwrap_or_else(|_| String::from("5"))
.parse::<u32>()
.unwrap_or_else(|_| {
warn!("No delay was set, setting up as 5 secs ..."); 5
});
let event_grub = tokio::spawn(async move { let event_grub = tokio::spawn(async move {
// GRAB USING eNODE.MONITORING API GATEWAY // GRAB USING eNODE.MONITORING API GATEWAY
if std::env::var("ENODE_MONITORING_IP").is_ok() { if std::env::var("ENODE_MONITORING_IP").is_ok() {
match get_metrics_from_monitoring(0, 5).await { match get_metrics_from_monitoring(0, request_delay as usize).await {
Ok(_) => info!("Grabing (eNODE.Monitoring) task de-initialized"), Ok(_) => info!("Grabing (eNODE.Monitoring) task de-initialized"),
Err(er) => error!("Grabing task returned an error : {}", er), Err(er) => error!("Grabing task returned an error : {}", er),
} }