|
29 | 29 | from synapse.util.caches import CacheMetric, register_cache |
30 | 30 | from synapse.util.caches.descriptors import lru_cache |
31 | 31 | from synapse.util.caches.lrucache import LruCache |
| 32 | +from synapse.util.metrics import measure_func |
32 | 33 |
|
33 | 34 | from .push_rule_evaluator import PushRuleEvaluatorForEvent |
34 | 35 |
|
@@ -105,6 +106,7 @@ class BulkPushRuleEvaluator: |
105 | 106 | def __init__(self, hs: "HomeServer"): |
106 | 107 | self.hs = hs |
107 | 108 | self.store = hs.get_datastores().main |
| 109 | + self.clock = hs.get_clock() |
108 | 110 | self._event_auth_handler = hs.get_event_auth_handler() |
109 | 111 |
|
110 | 112 | # Used by `RulesForRoom` to ensure only one thing mutates the cache at a |
@@ -185,13 +187,18 @@ async def _get_power_levels_and_sender_level( |
185 | 187 |
|
186 | 188 | return pl_event.content if pl_event else {}, sender_level |
187 | 189 |
|
| 190 | + @measure_func("action_for_event_by_user") |
188 | 191 | async def action_for_event_by_user( |
189 | 192 | self, event: EventBase, context: EventContext |
190 | 193 | ) -> None: |
191 | 194 | """Given an event and context, evaluate the push rules, check if the message |
192 | 195 | should increment the unread count, and insert the results into the |
193 | 196 | event_push_actions_staging table. |
194 | 197 | """ |
| 198 | + if event.internal_metadata.is_outlier(): |
| 199 | + # This can happen due to out of band memberships |
| 200 | + return |
| 201 | + |
195 | 202 | count_as_unread = _should_count_as_unread(event, context) |
196 | 203 |
|
197 | 204 | rules_by_user = await self._get_rules_for_event(event, context) |
|
0 commit comments