diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2019-03-19 04:50:24 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-19 04:50:24 +1100 |
commit | 282c97327f150a37d53f90ab6207bc1f98e70da3 (patch) | |
tree | 927982cf2c866ec4de99af633f507f892d28bfd9 /synapse/storage/background_updates.py | |
parent | Add ratelimiting on failed login attempts (#4865) (diff) | |
download | synapse-282c97327f150a37d53f90ab6207bc1f98e70da3.tar.xz |
Migrate the user directory initial population to a background task (#4864)
Diffstat (limited to 'synapse/storage/background_updates.py')
-rw-r--r-- | synapse/storage/background_updates.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/background_updates.py b/synapse/storage/background_updates.py index 60cdc884e6..a2f8c23a65 100644 --- a/synapse/storage/background_updates.py +++ b/synapse/storage/background_updates.py @@ -52,7 +52,9 @@ class BackgroundUpdatePerformance(object): Returns: A duration in ms as a float """ - if self.total_item_count == 0: + if self.avg_duration_ms == 0: + return 0 + elif self.total_item_count == 0: return None else: # Use the exponential moving average so that we can adapt to @@ -64,7 +66,9 @@ class BackgroundUpdatePerformance(object): Returns: A duration in ms as a float """ - if self.total_item_count == 0: + if self.total_duration_ms == 0: + return 0 + elif self.total_item_count == 0: return None else: return float(self.total_item_count) / float(self.total_duration_ms) |