0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-11-20 00:52:02 +01:00

Remove repeated calls to config.stats_enabled.

Turns out that fetching variables from the config object is expensive,
so doing it once at startup avoids unnecessary work.
This commit is contained in:
Erik Johnston 2019-10-25 10:28:36 +01:00
parent e39bc62b8a
commit f666d6f5d7

View file

@ -45,6 +45,8 @@ class StatsHandler(StateDeltasHandler):
self.is_mine_id = hs.is_mine_id self.is_mine_id = hs.is_mine_id
self.stats_bucket_size = hs.config.stats_bucket_size self.stats_bucket_size = hs.config.stats_bucket_size
self.stats_enabled = hs.config.stats_enabled
# The current position in the current_state_delta stream # The current position in the current_state_delta stream
self.pos = None self.pos = None
@ -61,7 +63,7 @@ class StatsHandler(StateDeltasHandler):
def notify_new_event(self): def notify_new_event(self):
"""Called when there may be more deltas to process """Called when there may be more deltas to process
""" """
if not self.hs.config.stats_enabled or self._is_processing: if not self.stats_enabled or self._is_processing:
return return
self._is_processing = True self._is_processing = True