fix: retry fetching music metadata

This commit is contained in:
dusk 2023-10-13 21:42:01 +03:00
parent 7961a79751
commit 2ee0620d23
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw

View File

@ -53,13 +53,20 @@ impl AppStateInternal {
let tokens_path = get_conf("TOKENS_FILE")?;
let music_info = MusicInfoMap::new();
music_info
.read(
musikcubed_password.clone(),
let fetch_music_info = || {
music_info.read(
&musikcubed_password,
&musikcubed_address,
musikcubed_metadata_port,
)
.await?;
};
let mut result = fetch_music_info().await;
while let Err(err) = result {
tracing::error!("error while trying to fetch music metadata from musikcubed: {err}");
tracing::info!("trying again in 5 seconds...");
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
result = fetch_music_info().await;
}
let this = Self {
client: Client::new(),