Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Remove repeated calls to config.stats_enabled. #6255

Merged
merged 3 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6255.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Small performance improvement by removing repeated config lookups in room stats calculation.
4 changes: 3 additions & 1 deletion synapse/handlers/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def __init__(self, hs):
self.is_mine_id = hs.is_mine_id
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
self.pos = None

Expand All @@ -61,7 +63,7 @@ def __init__(self, hs):
def notify_new_event(self):
"""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

self._is_processing = True
Expand Down