This commit is contained in:
Kasisnu committed 2024-09-20 13:30:44 +05:30
1 parent deb0ebc5e9
commit f1482c0076
3 files changed
+10 -12

No files matched your search

@@ -1,12 +1,10 @@
use std::thread;
use std::time::Duration;
use log::debug;
use log::error;
use log::warn;
use sqlx::MySqlPool;
use mysql_queries::queries::health_check::health_check_query::health_check_db;
use sqlx::MySqlPool;
use crate::threads::db_health_checker_thread::db_health_check_status::HealthCheckStatus;
@@ -34,7 +32,7 @@ pub async fn db_health_checker_thread(
}
}
thread::sleep(check_duration);
tokio::time::sleep(check_duration).await;
}
warn!("Should never happen: Health Checker Exits");
@@ -2,8 +2,8 @@ use std::collections::HashSet;
use std::thread;
use std::time::Duration;
use log::{debug, error, info};
use log::warn;
use log::{debug, error, info};
use sqlx::MySqlPool;
use actix_helpers::middleware::banned_ip_filter::ip_ban_list::ip_ban_list::IpBanList;
@@ -23,7 +23,7 @@ pub async fn poll_ip_bans(
Ok(bans) => bans,
Err(e) => {
error!("Error polling IP bans: {:?}", e);
thread::sleep(Duration::from_millis(30_000));
tokio::time::sleep(Duration::from_millis(30_000)).await;
continue;
}
};
@@ -49,6 +49,6 @@ pub async fn poll_ip_bans(
},
}
thread::sleep(Duration::from_millis(20_000));
tokio::time::sleep(Duration::from_millis(20_000)).await;
}
}
@@ -29,14 +29,14 @@ pub async fn poll_model_token_info_thread(
let interval_wait = easyenv::get_env_duration_seconds_or_default(
"POLL_MODEL_TOKEN_INTERVAL_SECS", Duration::from_secs(10 * 60));
std::thread::sleep(startup_wait);
tokio::time::sleep(startup_wait).await;
loop {
let token_info_items = match query_voice_conversion_models(&mysql_pool).await {
Ok(infos) => infos,
Err(err) => {
error!("Error polling voice conversion model token info: {:?}", err);
std::thread::sleep(error_wait);
tokio::time::sleep(error_wait).await;
continue;
}
};
@@ -49,13 +49,13 @@ pub async fn poll_model_token_info_thread(
error!("Error inserting model token info: {:?}", err);
}
std::thread::sleep(between_wait);
tokio::time::sleep(between_wait).await;
let token_info_items = match query_model_weight_models(&mysql_pool).await {
Ok(infos) => infos,
Err(err) => {
error!("Error polling model weight token info: {:?}", err);
std::thread::sleep(error_wait);
tokio::time::sleep(error_wait).await;
continue;
}
};
@@ -68,7 +68,7 @@ pub async fn poll_model_token_info_thread(
error!("Error inserting model token info: {:?}", err);
}
std::thread::sleep(interval_wait);
tokio::time::sleep(interval_wait).await;
}
}