update
This commit is contained in:
@@ -681,6 +681,20 @@ async fn update_game_db(games: Vec<Game>, app: AppHandle) {
|
||||
for peer_game in games {
|
||||
if let Some(existing) = game_db.get_mut_game_by_id(&peer_game.id) {
|
||||
existing.peer_count = peer_game.peer_count;
|
||||
|
||||
if let Some(peer_version) = &peer_game.eti_game_version {
|
||||
match &existing.eti_game_version {
|
||||
Some(current_version) if current_version >= peer_version => {}
|
||||
_ => {
|
||||
existing.eti_game_version = Some(peer_version.clone());
|
||||
log::debug!(
|
||||
"Updated eti_game_version for {} to {} based on peer data",
|
||||
peer_game.id,
|
||||
peer_version
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log::debug!(
|
||||
"Peer advertised unknown game {id}; ignoring because game.db is ground truth",
|
||||
|
||||
Reference in New Issue
Block a user