mirror of
https://github.com/Dummi26/musicdb.git
synced 2025-03-10 14:13:53 +01:00
fix get-song returning "no data" instead of loading the song
This commit is contained in:
parent
b70d922fad
commit
8b8f13f98a
@ -112,7 +112,7 @@ impl Song {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Gets the cached data, if available.
|
/// Gets or loads the cached data.
|
||||||
/// If a thread is running to load the data, it *is* awaited.
|
/// If a thread is running to load the data, it *is* awaited.
|
||||||
/// This function will block until the data is loaded.
|
/// This function will block until the data is loaded.
|
||||||
/// If it still returns none, some error must have occured.
|
/// If it still returns none, some error must have occured.
|
||||||
|
@ -122,10 +122,8 @@ pub fn handle_one_connection_as_get(
|
|||||||
.next()
|
.next()
|
||||||
.and_then(|id| id.parse().ok())
|
.and_then(|id| id.parse().ok())
|
||||||
.and_then(|id| {
|
.and_then(|id| {
|
||||||
db.lock()
|
let db = db.lock().unwrap();
|
||||||
.unwrap()
|
db.get_song(&id).and_then(|song| song.cached_data_now(&db))
|
||||||
.get_song(&id)
|
|
||||||
.and_then(|song| song.cached_data())
|
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
writeln!(connection.get_mut(), "len: {}", bytes.len())?;
|
writeln!(connection.get_mut(), "len: {}", bytes.len())?;
|
||||||
|
Loading…
Reference in New Issue
Block a user