Wait for service fn simplification
This commit is contained in:
parent
161a006ebe
commit
912871f833
33
services.rs
33
services.rs
|
@ -90,26 +90,19 @@ fn stop_service(name: &String) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn wait_for_service(proxy: &ProxyConf) {
|
async fn wait_for_service(proxy: &ProxyConf) {
|
||||||
if proxy.socket {
|
if proxy.socket {
|
||||||
|
let path = Path::new(&proxy.target);
|
||||||
let path = Path::new(&proxy.target);
|
while !path.exists() {
|
||||||
while !path.exists() {
|
sleep(Duration::from_millis(100)).await;
|
||||||
sleep(Duration::from_millis(100)).await;
|
}
|
||||||
}
|
} else {
|
||||||
|
while target_to_address(&proxy.target)
|
||||||
} else {
|
.map(|address| TcpStream::connect(address).is_err())
|
||||||
|
.unwrap_or(true)
|
||||||
if let Some(address) = target_to_address(&proxy.target) {
|
{
|
||||||
loop {
|
sleep(Duration::from_millis(100)).await;
|
||||||
sleep(Duration::from_millis(100)).await;
|
}
|
||||||
match TcpStream::connect(address) {
|
}
|
||||||
Ok(_) => break,
|
|
||||||
Err(_) => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn prepare_services() {
|
pub async fn prepare_services() {
|
||||||
|
|
Loading…
Reference in a new issue