chiark / gitweb /
conditional logs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 22 Aug 2020 18:02:10 +0000 (19:02 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 22 Aug 2020 18:02:10 +0000 (19:02 +0100)
src/cmdlistener.rs

index 21ea5af2c7ec42490325d985a951151d26337863..dbf9dc50b626a15626ec4cd36b3c3139ace3eeeb 100644 (file)
@@ -261,6 +261,7 @@ fn execute(cs: &mut CommandStream, cmd: MgmtCommand) -> MgmtResponse {
 #[derive(Debug,Default)]
 struct UpdateHandlerBulk {
   pieces : slotmap::SparseSecondaryMap<PieceId, PieceUpdateOp<()>>,
+  logs : bool,
 }
 
 #[derive(Debug)]
@@ -299,7 +300,7 @@ impl UpdateHandler {
             None     => { bulk.pieces.remove(upiece); },
           };
         }
-        let _logs = ulogs;
+        bulk.logs |= ulogs.len() != 0;
       },
       Online => {
         let estimate = upieces.len() + ulogs.len();
@@ -324,11 +325,13 @@ impl UpdateHandler {
           buf.piece_update(upiece, uuop, &lens);
         }
 
-        buf.log_updates(vec![LogEntry {
-          html: "The facilitator (re)configured the game".to_owned(),
-          // xxx use cs.desc
-        }]);
-        },
+        if bulk.logs {
+          buf.log_updates(vec![LogEntry {
+            html: "The facilitator (re)configured the game".to_owned(),
+            // xxx use cs.desc
+          }]);
+        }
+      },
       Online => { },
     }
   }