From 39dbee2a3e129415e2c20aa9a4f5f866e723fe41 Mon Sep 17 00:00:00 2001 From: "Olivier Wilkinson (reivilibre)" Date: Thu, 29 Aug 2019 14:10:21 +0100 Subject: Count total_events and total_event_bytes within the loop. In this case, we still update these counts if we get stuck in the loop because the server is busy. Signed-off-by: Olivier Wilkinson (reivilibre) --- synapse/storage/stats.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'synapse/storage') diff --git a/synapse/storage/stats.py b/synapse/storage/stats.py index 8cfa694d31..9d6c3027d5 100644 --- a/synapse/storage/stats.py +++ b/synapse/storage/stats.py @@ -487,9 +487,12 @@ class StatsStore(StateDeltasStore): in_positions (dict): Positions, as retrieved from L{get_stats_positions}. - Returns (dict): - The new positions. Note that this is for reference only – - the new positions WILL be committed by this function. + Returns (Deferred[tuple[dict, bool]]): + First element (dict): + The new positions. Note that this is for reference only – + the new positions WILL be committed by this function. + Second element (bool): + true iff there was a change to the positions, false otherwise """ def incremental_update_total_events_and_bytes_txn(txn): @@ -518,7 +521,9 @@ class StatsStore(StateDeltasStore): self._update_stats_positions_txn(txn, positions) - return positions + return positions, True + else: + return positions, False return self.runInteraction( "stats_incremental_total_events_and_bytes", -- cgit 1.5.1