ugly
This commit is contained in:
@@ -1854,6 +1854,10 @@ async fn handle_peer_stream(
|
||||
if let Some(ref db) = *db_guard {
|
||||
db.all_games().into_iter().cloned().collect::<Vec<Game>>()
|
||||
} else {
|
||||
// Local database not loaded yet, return empty result
|
||||
log::info!(
|
||||
"Local game database not yet loaded, responding with empty game list"
|
||||
);
|
||||
Vec::new()
|
||||
}
|
||||
};
|
||||
|
||||
@@ -892,6 +892,9 @@ pub fn run() {
|
||||
*state.peer_ctrl.write().await = Some(peer_ctrl);
|
||||
log::info!("Peer system initialized successfully with games directory");
|
||||
|
||||
// Wait a moment for local game database to be loaded before starting discovery
|
||||
tokio::time::sleep(tokio::time::Duration::from_millis(2000)).await;
|
||||
|
||||
// Start peer discovery and request games from other peers
|
||||
if let Err(e) = request_games(state).await {
|
||||
log::error!("Failed to request games after peer init: {e}");
|
||||
|
||||
Reference in New Issue
Block a user