chore: pretty_env_logger, new web_rt.block_on out of monitor loop
This commit is contained in:
parent
683f606e33
commit
c5a3c470ac
10
src/main.rs
10
src/main.rs
@ -310,6 +310,7 @@ pub fn main() -> Result<()> {
|
|||||||
let env_path = std::path::Path::new(&arg_env_path);
|
let env_path = std::path::Path::new(&arg_env_path);
|
||||||
dotenv::from_path(env_path)?;
|
dotenv::from_path(env_path)?;
|
||||||
}
|
}
|
||||||
|
pretty_env_logger::init();
|
||||||
// assert!(output.is_ok());
|
// assert!(output.is_ok());
|
||||||
let loop_duration: u64;
|
let loop_duration: u64;
|
||||||
let run_cache: bool;
|
let run_cache: bool;
|
||||||
@ -338,9 +339,16 @@ pub fn main() -> Result<()> {
|
|||||||
let rt = tokio::runtime::Runtime::new().unwrap_or_else(|e|
|
let rt = tokio::runtime::Runtime::new().unwrap_or_else(|e|
|
||||||
panic!("Error create tokio runtime {}",e)
|
panic!("Error create tokio runtime {}",e)
|
||||||
);
|
);
|
||||||
|
let webs_rt = tokio::runtime::Runtime::new().unwrap_or_else(|e|
|
||||||
|
panic!("Error create webs tokio runtime {}",e)
|
||||||
|
);
|
||||||
|
let mut web_tasks = Vec::new();
|
||||||
|
webs_rt.block_on(async move {
|
||||||
|
web_tasks.push(tokio::spawn(async move {up_web_server().await }));
|
||||||
|
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
||||||
|
});
|
||||||
loop {
|
loop {
|
||||||
rt.block_on(async move {
|
rt.block_on(async move {
|
||||||
tokio::spawn(async move {up_web_server().await });
|
|
||||||
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
||||||
if run_check {
|
if run_check {
|
||||||
tokio::spawn(async {run_check_clouds().await }); // For async task
|
tokio::spawn(async {run_check_clouds().await }); // For async task
|
||||||
|
Loading…
Reference in New Issue
Block a user