log error on failed summary lookup, keep other games unchanged
authorGeoffrey Allott <geoffrey@allott.email>
Sat, 27 Feb 2021 13:41:49 +0000 (13:41 +0000)
committerGeoffrey Allott <geoffrey@allott.email>
Sat, 27 Feb 2021 13:41:49 +0000 (13:41 +0000)
src/server.rs

index 42bb1fa90ec6cf90b39e171b58f082add3df8c75..455c98b787a76d887d4fe8c4f4d5b6109a099c93 100644 (file)
@@ -163,9 +163,12 @@ impl ServerState {
     pub async fn game_list(&mut self, from: usize) -> RedisResult<Vec<GameSummary>> {
         debug!("game_list(from: {})", from);
         let games: Vec<u32> = self.redis.lrange("game:list", from as isize, -1).await?;
-        let mut summaries = Vec::new();
+        let mut summaries = Vec::with_capacity(games.len());
         for id in games {
-            summaries.push(self.game_summary(id).await?);
+            match self.game_summary(id).await {
+                Ok(summary) => summaries.push(summary),
+                Err(err) => error!("Could not find summary for game {}", id),
+            }
         }
         Ok(summaries)
     }