chore: move all tokio runtimes to one
This commit is contained in:
parent
072d50047c
commit
a1781ee739
@ -351,13 +351,10 @@ pub fn main() -> Result<()> {
|
|||||||
// println!("content: {}",&config_content);
|
// println!("content: {}",&config_content);
|
||||||
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();
|
// let mut web_tasks = Vec::new();
|
||||||
websrvrs.iter().enumerate().for_each(|(pos,it)| {
|
websrvrs.iter().enumerate().for_each(|(pos,it)| {
|
||||||
webs_rt.block_on(async move {
|
rt.block_on(async move {
|
||||||
println!("{} -> {}",it.name,pos);
|
println!("{} -> {}",it.name,pos);
|
||||||
tokio::spawn(async move {up_web_server(pos).await});
|
tokio::spawn(async move {up_web_server(pos).await});
|
||||||
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
||||||
@ -365,7 +362,6 @@ pub fn main() -> Result<()> {
|
|||||||
});
|
});
|
||||||
loop {
|
loop {
|
||||||
rt.block_on(async move {
|
rt.block_on(async move {
|
||||||
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
|
||||||
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
|
||||||
|
Loading…
Reference in New Issue
Block a user