This commit is contained in:
Ahmed Ibrahim
2025-12-01 13:26:50 -08:00
parent 0809a45e1c
commit 50cff7b1af
2 changed files with 2 additions and 11 deletions

View File

@@ -17,6 +17,7 @@
use std::fs::File;
use std::fs::OpenOptions;
use std::io::Result;
use std::io::Write;
use std::path::PathBuf;
use serde::Deserialize;

View File

@@ -447,16 +447,6 @@ fn bind_server(port: u16) -> io::Result<Server> {
const MAX_ATTEMPTS: u32 = 10;
const RETRY_DELAY: Duration = Duration::from_millis(200);
fn retry_sleep(delay: Duration) {
if tokio::runtime::Handle::try_current().is_ok() {
let _ = tokio::task::block_in_place(|| {
std::thread::sleep(delay);
});
} else {
std::thread::sleep(delay);
}
}
loop {
match Server::http(&bind_address) {
Ok(server) => return Ok(server),
@@ -477,7 +467,7 @@ fn bind_server(port: u16) -> io::Result<Server> {
}
}
retry_sleep(RETRY_DELAY);
thread::sleep(RETRY_DELAY);
if attempts >= MAX_ATTEMPTS {
return Err(io::Error::new(