diff options
author | Erik Johnston <erik@matrix.org> | 2017-05-08 16:06:17 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-05-08 16:06:17 +0100 |
commit | ffad4fe35be3baba5b2fffaa4e9b31f3008d09af (patch) | |
tree | 726208f0cb47cbd81a1fd5009351ce4b7435f57b /synapse/storage/events.py | |
parent | Increase client_ip cache size (diff) | |
download | synapse-ffad4fe35be3baba5b2fffaa4e9b31f3008d09af.tar.xz |
Don't update event cache hit ratio from get_joined_users
Otherwise the hit ration of plain get_events gets completely skewed by calls to get_joined_users* functions.
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r-- | synapse/storage/events.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 98707d40ee..d944984d61 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -1343,11 +1343,20 @@ class EventsStore(SQLBaseStore): def _invalidate_get_event_cache(self, event_id): self._get_event_cache.invalidate((event_id,)) - def _get_events_from_cache(self, events, allow_rejected): + def _get_events_from_cache(self, events, allow_rejected, update_metrics=True): + """ + Args: + events (list(str)): list of event_ids to fetch + allow_rejected (bool): Whether to teturn events that were rejected + update_metrics (bool): Whether to update the cache hit ratio metrics + """ event_map = {} for event_id in events: - ret = self._get_event_cache.get((event_id,), None) + ret = self._get_event_cache.get( + (event_id,), None, + update_metrics=update_metrics, + ) if not ret: continue |