From dc3a00f24f301ab08750fdd8ca6ae040ba290e1e Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 15 Aug 2016 17:04:39 +0100 Subject: Refactor user_delete_access_tokens. Invalidate get_user_by_access_token to slaves. --- synapse/push/pusherpool.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'synapse/push') diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py index 5853ec36a9..54c0f1b849 100644 --- a/synapse/push/pusherpool.py +++ b/synapse/push/pusherpool.py @@ -102,14 +102,14 @@ class PusherPool: yield self.remove_pusher(p['app_id'], p['pushkey'], p['user_name']) @defer.inlineCallbacks - def remove_pushers_by_user(self, user_id, except_token_ids=[]): + def remove_pushers_by_user(self, user_id, except_access_token_id=None): all = yield self.store.get_all_pushers() logger.info( - "Removing all pushers for user %s except access tokens ids %r", - user_id, except_token_ids + "Removing all pushers for user %s except access tokens id %r", + user_id, except_access_token_id ) for p in all: - if p['user_name'] == user_id and p['access_token'] not in except_token_ids: + if p['user_name'] == user_id and p['access_token'] != except_access_token_id: logger.info( "Removing pusher for app id %s, pushkey %s, user %s", p['app_id'], p['pushkey'], p['user_name'] -- cgit 1.4.1 From 1c7c317df1124ff262d40b40966956a952d1e03b Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 15 Aug 2016 18:34:53 +0100 Subject: Move display name rule As per https://github.com/matrix-org/matrix-doc/pull/373 and comment --- synapse/push/baserules.py | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'synapse/push') diff --git a/synapse/push/baserules.py b/synapse/push/baserules.py index 024c14904f..9d60f76968 100644 --- a/synapse/push/baserules.py +++ b/synapse/push/baserules.py @@ -217,45 +217,49 @@ BASE_APPEND_OVERRIDE_RULES = [ 'dont_notify' ] }, -] - - -BASE_APPEND_UNDERRIDE_RULES = [ + # This was changed from underride to override so it's closer in priority + # to the content rules where the user name highlight rule lives. This + # way a room rule is lower priority than both but a custom override rule + # is higher priority than both. { - 'rule_id': 'global/underride/.m.rule.call', + 'rule_id': 'global/underride/.m.rule.contains_display_name', 'conditions': [ { - 'kind': 'event_match', - 'key': 'type', - 'pattern': 'm.call.invite', - '_id': '_call', + 'kind': 'contains_display_name' } ], 'actions': [ 'notify', { 'set_tweak': 'sound', - 'value': 'ring' + 'value': 'default' }, { - 'set_tweak': 'highlight', - 'value': False + 'set_tweak': 'highlight' } ] }, +] + + +BASE_APPEND_UNDERRIDE_RULES = [ { - 'rule_id': 'global/underride/.m.rule.contains_display_name', + 'rule_id': 'global/underride/.m.rule.call', 'conditions': [ { - 'kind': 'contains_display_name' + 'kind': 'event_match', + 'key': 'type', + 'pattern': 'm.call.invite', + '_id': '_call', } ], 'actions': [ 'notify', { 'set_tweak': 'sound', - 'value': 'default' + 'value': 'ring' }, { - 'set_tweak': 'highlight' + 'set_tweak': 'highlight', + 'value': False } ] }, -- cgit 1.4.1 From 1594eba29e7c47ebc46a1fd73e1cfb6742a66df9 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 16 Aug 2016 16:44:07 +0100 Subject: s/underride/override/ in the rule_id too --- synapse/push/baserules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'synapse/push') diff --git a/synapse/push/baserules.py b/synapse/push/baserules.py index 9d60f76968..edb00ed206 100644 --- a/synapse/push/baserules.py +++ b/synapse/push/baserules.py @@ -222,7 +222,7 @@ BASE_APPEND_OVERRIDE_RULES = [ # way a room rule is lower priority than both but a custom override rule # is higher priority than both. { - 'rule_id': 'global/underride/.m.rule.contains_display_name', + 'rule_id': 'global/override/.m.rule.contains_display_name', 'conditions': [ { 'kind': 'contains_display_name' -- cgit 1.4.1 From abcb9aee5b52421df620830609606d778eeb8ca0 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 17 Aug 2016 18:00:04 +0100 Subject: Make push Measure finer grained --- synapse/push/action_generator.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'synapse/push') diff --git a/synapse/push/action_generator.py b/synapse/push/action_generator.py index 46e768e35c..b2c94bfaac 100644 --- a/synapse/push/action_generator.py +++ b/synapse/push/action_generator.py @@ -38,15 +38,16 @@ class ActionGenerator: @defer.inlineCallbacks def handle_push_actions_for_event(self, event, context): - with Measure(self.clock, "handle_push_actions_for_event"): + with Measure(self.clock, "evaluator_for_event"): bulk_evaluator = yield evaluator_for_event( event, self.hs, self.store, context.current_state ) + with Measure(self.clock, "action_for_event_by_user"): actions_by_user = yield bulk_evaluator.action_for_event_by_user( event, context.current_state ) - context.push_actions = [ - (uid, actions) for uid, actions in actions_by_user.items() - ] + context.push_actions = [ + (uid, actions) for uid, actions in actions_by_user.items() + ] -- cgit 1.4.1