Wait until qbittorrent is reachable on startup

This commit is contained in:
SeanOMik 2023-12-13 20:12:47 -05:00
parent 1a933dcf91
commit 2a145822fd
Signed by: SeanOMik
GPG Key ID: 568F326C7EB33ACB
1 changed files with 7 additions and 1 deletions

View File

@ -38,7 +38,13 @@ fn main() -> anyhow::Result<()> {
println!("Couldn't find {}", config.port_file);
println!("Trying again in 10 seconds");
std::thread::sleep(Duration::from_secs(10));
}
}
while reqwest::blocking::get(config.qbit_full_url()).and_then(|r| r.error_for_status()).is_err() {
println!("Couldn't reach qbittorrent at {}", config.qbit_full_url());
println!("Trying again in 10 seconds");
std::thread::sleep(Duration::from_secs(10));
}
let config_clone = config.clone();
let mut watcher = notify::recommended_watcher(move |res: Result<Event, notify::Error>| {