mirror of
				https://github.com/Dummi26/musicdb.git
				synced 2025-11-04 05:16:17 +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
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    /// Gets the cached data, if available.
 | 
			
		||||
    /// Gets or loads the cached data.
 | 
			
		||||
    /// If a thread is running to load the data, it *is* awaited.
 | 
			
		||||
    /// This function will block until the data is loaded.
 | 
			
		||||
    /// If it still returns none, some error must have occured.
 | 
			
		||||
 | 
			
		||||
@ -122,10 +122,8 @@ pub fn handle_one_connection_as_get(
 | 
			
		||||
                                .next()
 | 
			
		||||
                                .and_then(|id| id.parse().ok())
 | 
			
		||||
                                .and_then(|id| {
 | 
			
		||||
                                    db.lock()
 | 
			
		||||
                                        .unwrap()
 | 
			
		||||
                                        .get_song(&id)
 | 
			
		||||
                                        .and_then(|song| song.cached_data())
 | 
			
		||||
                                    let db = db.lock().unwrap();
 | 
			
		||||
                                    db.get_song(&id).and_then(|song| song.cached_data_now(&db))
 | 
			
		||||
                                })
 | 
			
		||||
                        {
 | 
			
		||||
                            writeln!(connection.get_mut(), "len: {}", bytes.len())?;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user