mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Add fastpath optimisation
This commit is contained in:
parent
e433393c4f
commit
ed80c6b6cc
@ -112,9 +112,15 @@ class BulkPushRuleEvaluator(object):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _get_sender_power_level(self, event, context):
|
def _get_sender_power_level(self, event, context):
|
||||||
auth_events_ids = yield self.auth.compute_auth_events(
|
pl_event_key = (EventTypes.PowerLevels, "", )
|
||||||
event, context.prev_state_ids, for_verification=False,
|
if pl_event_key in context.prev_state_ids:
|
||||||
)
|
# fastpath: if there's a power level event, that's all we need, and
|
||||||
|
# not having a power level event is an extreme edge case
|
||||||
|
auth_events_ids = [context.prev_state_ids[pl_event_key]]
|
||||||
|
else:
|
||||||
|
auth_events_ids = yield self.auth.compute_auth_events(
|
||||||
|
event, context.prev_state_ids, for_verification=False,
|
||||||
|
)
|
||||||
auth_events = yield self.store.get_events(auth_events_ids)
|
auth_events = yield self.store.get_events(auth_events_ids)
|
||||||
auth_events = {
|
auth_events = {
|
||||||
(e.type, e.state_key): e for e in auth_events.values()
|
(e.type, e.state_key): e for e in auth_events.values()
|
||||||
|
Loading…
Reference in New Issue
Block a user