fix: retry fetching music metadata
This commit is contained in:
parent
7961a79751
commit
2ee0620d23
15
src/state.rs
15
src/state.rs
@ -53,13 +53,20 @@ impl AppStateInternal {
|
|||||||
let tokens_path = get_conf("TOKENS_FILE")?;
|
let tokens_path = get_conf("TOKENS_FILE")?;
|
||||||
|
|
||||||
let music_info = MusicInfoMap::new();
|
let music_info = MusicInfoMap::new();
|
||||||
music_info
|
let fetch_music_info = || {
|
||||||
.read(
|
music_info.read(
|
||||||
musikcubed_password.clone(),
|
&musikcubed_password,
|
||||||
&musikcubed_address,
|
&musikcubed_address,
|
||||||
musikcubed_metadata_port,
|
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 {
|
let this = Self {
|
||||||
client: Client::new(),
|
client: Client::new(),
|
||||||
|
Loading…
Reference in New Issue
Block a user