diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py
index e7c964bcd2..a5dc84160c 100644
--- a/synapse/push/__init__.py
+++ b/synapse/push/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2015 OpenMarket Ltd
+# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,12 +27,15 @@ import random
logger = logging.getLogger(__name__)
+# Pushers could now be moved to pull out of the event_push_actions table instead
+# of listening on the event stream: this would avoid them having to run the
+# rules again.
class Pusher(object):
INITIAL_BACKOFF = 1000
MAX_BACKOFF = 60 * 60 * 1000
GIVE_UP_AFTER = 24 * 60 * 60 * 1000
- def __init__(self, _hs, profile_tag, user_name, app_id,
+ def __init__(self, _hs, profile_tag, user_id, app_id,
app_display_name, device_display_name, pushkey, pushkey_ts,
data, last_token, last_success, failing_since):
self.hs = _hs
@@ -40,7 +43,7 @@ class Pusher(object):
self.store = self.hs.get_datastore()
self.clock = self.hs.get_clock()
self.profile_tag = profile_tag
- self.user_name = user_name
+ self.user_id = user_id
self.app_id = app_id
self.app_display_name = app_display_name
self.device_display_name = device_display_name
@@ -89,15 +92,15 @@ class Pusher(object):
# we fail to dispatch the push)
config = PaginationConfig(from_token=None, limit='1')
chunk = yield self.evStreamHandler.get_stream(
- self.user_name, config, timeout=0, affect_presence=False,
+ self.user_id, config, timeout=0, affect_presence=False,
only_room_events=True
)
self.last_token = chunk['end']
self.store.update_pusher_last_token(
- self.app_id, self.pushkey, self.user_name, self.last_token
+ self.app_id, self.pushkey, self.user_id, self.last_token
)
logger.info("Pusher %s for user %s starting from token %s",
- self.pushkey, self.user_name, self.last_token)
+ self.pushkey, self.user_id, self.last_token)
wait = 0
while self.alive:
@@ -122,7 +125,7 @@ class Pusher(object):
config = PaginationConfig(from_token=from_tok, limit='1')
timeout = (300 + random.randint(-60, 60)) * 1000
chunk = yield self.evStreamHandler.get_stream(
- self.user_name, config, timeout=timeout, affect_presence=False,
+ self.user_id, config, timeout=timeout, affect_presence=False,
only_room_events=True
)
@@ -139,7 +142,7 @@ class Pusher(object):
yield self.store.update_pusher_last_token(
self.app_id,
self.pushkey,
- self.user_name,
+ self.user_id,
self.last_token
)
return
@@ -150,28 +153,14 @@ class Pusher(object):
processed = False
rule_evaluator = yield \
- push_rule_evaluator.evaluator_for_user_name_and_profile_tag(
- self.user_name, self.profile_tag, single_event['room_id'], self.store
+ push_rule_evaluator.evaluator_for_user_id_and_profile_tag(
+ self.user_id, self.profile_tag, single_event['room_id'], self.store
)
actions = yield rule_evaluator.actions_for_event(single_event)
tweaks = rule_evaluator.tweaks_for_actions(actions)
- if len(actions) == 0:
- logger.warn("Empty actions! Using default action.")
- actions = Pusher.DEFAULT_ACTIONS
-
- if 'notify' not in actions and 'dont_notify' not in actions:
- logger.warn("Neither notify nor dont_notify in actions: adding default")
- actions.extend(Pusher.DEFAULT_ACTIONS)
-
- if 'dont_notify' in actions:
- logger.debug(
- "%s for %s: dont_notify",
- single_event['event_id'], self.user_name
- )
- processed = True
- else:
+ if 'notify' in actions:
rejected = yield self.dispatch_push(single_event, tweaks)
self.has_unread = True
if isinstance(rejected, list) or isinstance(rejected, tuple):
@@ -190,8 +179,10 @@ class Pusher(object):
pk
)
yield self.hs.get_pusherpool().remove_pusher(
- self.app_id, pk, self.user_name
+ self.app_id, pk, self.user_id
)
+ else:
+ processed = True
if not self.alive:
return
@@ -202,7 +193,7 @@ class Pusher(object):
yield self.store.update_pusher_last_token_and_success(
self.app_id,
self.pushkey,
- self.user_name,
+ self.user_id,
self.last_token,
self.clock.time_msec()
)
@@ -211,7 +202,7 @@ class Pusher(object):
yield self.store.update_pusher_failing_since(
self.app_id,
self.pushkey,
- self.user_name,
+ self.user_id,
self.failing_since)
else:
if not self.failing_since:
@@ -219,7 +210,7 @@ class Pusher(object):
yield self.store.update_pusher_failing_since(
self.app_id,
self.pushkey,
- self.user_name,
+ self.user_id,
self.failing_since
)
@@ -231,13 +222,13 @@ class Pusher(object):
# of old notifications.
logger.warn("Giving up on a notification to user %s, "
"pushkey %s",
- self.user_name, self.pushkey)
+ self.user_id, self.pushkey)
self.backoff_delay = Pusher.INITIAL_BACKOFF
self.last_token = chunk['end']
yield self.store.update_pusher_last_token(
self.app_id,
self.pushkey,
- self.user_name,
+ self.user_id,
self.last_token
)
@@ -245,14 +236,14 @@ class Pusher(object):
yield self.store.update_pusher_failing_since(
self.app_id,
self.pushkey,
- self.user_name,
+ self.user_id,
self.failing_since
)
else:
logger.warn("Failed to dispatch push for user %s "
"(failing for %dms)."
"Trying again in %dms",
- self.user_name,
+ self.user_id,
self.clock.time_msec() - self.failing_since,
self.backoff_delay)
yield synapse.util.async.sleep(self.backoff_delay / 1000.0)
@@ -289,7 +280,7 @@ class Pusher(object):
if last_active > self.last_last_active_time:
self.last_last_active_time = last_active
if self.has_unread:
- logger.info("Resetting badge count for %s", self.user_name)
+ logger.info("Resetting badge count for %s", self.user_id)
self.reset_badge_count()
self.has_unread = False
diff --git a/synapse/push/action_generator.py b/synapse/push/action_generator.py
new file mode 100644
index 0000000000..73467f3adc
--- /dev/null
+++ b/synapse/push/action_generator.py
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+# Copyright 2015 OpenMarket Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from twisted.internet import defer
+
+import bulk_push_rule_evaluator
+
+import logging
+
+from synapse.api.constants import EventTypes
+
+logger = logging.getLogger(__name__)
+
+
+class ActionGenerator:
+ def __init__(self, store):
+ self.store = store
+ # really we want to get all user ids and all profile tags too,
+ # since we want the actions for each profile tag for every user and
+ # also actions for a client with no profile tag for each user.
+ # Currently the event stream doesn't support profile tags on an
+ # event stream, so we just run the rules for a client with no profile
+ # tag (ie. we just need all the users).
+
+ @defer.inlineCallbacks
+ def handle_push_actions_for_event(self, event, handler):
+ # Temporarily disable notifications due to performance concerns.
+ return
+
+ if event.type == EventTypes.Redaction and event.redacts is not None:
+ yield self.store.remove_push_actions_for_event_id(
+ event.room_id, event.redacts
+ )
+
+ bulk_evaluator = yield bulk_push_rule_evaluator.evaluator_for_room_id(
+ event.room_id, self.store
+ )
+
+ actions_by_user = yield bulk_evaluator.action_for_event_by_user(event, handler)
+
+ yield self.store.set_push_actions_for_event_and_users(
+ event,
+ [
+ (uid, None, actions) for uid, actions in actions_by_user.items()
+ ]
+ )
diff --git a/synapse/push/baserules.py b/synapse/push/baserules.py
index 7f76382a17..8bac7fd6af 100644
--- a/synapse/push/baserules.py
+++ b/synapse/push/baserules.py
@@ -1,4 +1,4 @@
-# Copyright 2015 OpenMarket Ltd
+# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,27 +15,27 @@
from synapse.push.rulekinds import PRIORITY_CLASS_MAP, PRIORITY_CLASS_INVERSE_MAP
-def list_with_base_rules(rawrules, user_name):
+def list_with_base_rules(rawrules, user_id):
ruleslist = []
# shove the server default rules for each kind onto the end of each
current_prio_class = PRIORITY_CLASS_INVERSE_MAP.keys()[-1]
ruleslist.extend(make_base_prepend_rules(
- user_name, PRIORITY_CLASS_INVERSE_MAP[current_prio_class]
+ user_id, PRIORITY_CLASS_INVERSE_MAP[current_prio_class]
))
for r in rawrules:
if r['priority_class'] < current_prio_class:
while r['priority_class'] < current_prio_class:
ruleslist.extend(make_base_append_rules(
- user_name,
+ user_id,
PRIORITY_CLASS_INVERSE_MAP[current_prio_class]
))
current_prio_class -= 1
if current_prio_class > 0:
ruleslist.extend(make_base_prepend_rules(
- user_name,
+ user_id,
PRIORITY_CLASS_INVERSE_MAP[current_prio_class]
))
@@ -43,13 +43,13 @@ def list_with_base_rules(rawrules, user_name):
while current_prio_class > 0:
ruleslist.extend(make_base_append_rules(
- user_name,
+ user_id,
PRIORITY_CLASS_INVERSE_MAP[current_prio_class]
))
current_prio_class -= 1
if current_prio_class > 0:
ruleslist.extend(make_base_prepend_rules(
- user_name,
+ user_id,
PRIORITY_CLASS_INVERSE_MAP[current_prio_class]
))
diff --git a/synapse/push/bulk_push_rule_evaluator.py b/synapse/push/bulk_push_rule_evaluator.py
new file mode 100644
index 0000000000..ce244fa959
--- /dev/null
+++ b/synapse/push/bulk_push_rule_evaluator.py
@@ -0,0 +1,124 @@
+# -*- coding: utf-8 -*-
+# Copyright 2015 OpenMarket Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import logging
+import simplejson as json
+
+from twisted.internet import defer
+
+from synapse.types import UserID
+
+import baserules
+from push_rule_evaluator import PushRuleEvaluator
+
+from synapse.events.utils import serialize_event
+
+logger = logging.getLogger(__name__)
+
+
+def decode_rule_json(rule):
+ rule['conditions'] = json.loads(rule['conditions'])
+ rule['actions'] = json.loads(rule['actions'])
+ return rule
+
+
+@defer.inlineCallbacks
+def evaluator_for_room_id(room_id, store):
+ users = yield store.get_users_in_room(room_id)
+ rules_by_user = yield store.bulk_get_push_rules(users)
+ rules_by_user = {
+ uid: baserules.list_with_base_rules(
+ [decode_rule_json(rule_list) for rule_list in rules_by_user[uid]]
+ if uid in rules_by_user else [],
+ UserID.from_string(uid),
+ )
+ for uid in users
+ }
+ member_events = yield store.get_current_state(
+ room_id=room_id,
+ event_type='m.room.member',
+ )
+ display_names = {}
+ for ev in member_events:
+ if ev.content.get("displayname"):
+ display_names[ev.state_key] = ev.content.get("displayname")
+
+ defer.returnValue(BulkPushRuleEvaluator(
+ room_id, rules_by_user, display_names, users, store
+ ))
+
+
+class BulkPushRuleEvaluator:
+ """
+ Runs push rules for all users in a room.
+ This is faster than running PushRuleEvaluator for each user because it
+ fetches all the rules for all the users in one (batched) db query
+ rather than doing multiple queries per-user. It currently uses
+ the same logic to run the actual rules, but could be optimised further
+ (see https://matrix.org/jira/browse/SYN-562)
+ """
+ def __init__(self, room_id, rules_by_user, display_names, users_in_room, store):
+ self.room_id = room_id
+ self.rules_by_user = rules_by_user
+ self.display_names = display_names
+ self.users_in_room = users_in_room
+ self.store = store
+
+ @defer.inlineCallbacks
+ def action_for_event_by_user(self, event, handler):
+ actions_by_user = {}
+
+ for uid, rules in self.rules_by_user.items():
+ display_name = None
+ if uid in self.display_names:
+ display_name = self.display_names[uid]
+
+ is_guest = yield self.store.is_guest(UserID.from_string(uid))
+ filtered = yield handler._filter_events_for_client(
+ uid, [event], is_guest=is_guest
+ )
+ if len(filtered) == 0:
+ continue
+
+ for rule in rules:
+ if 'enabled' in rule and not rule['enabled']:
+ continue
+
+ # XXX: profile tags
+ if BulkPushRuleEvaluator.event_matches_rule(
+ event, rule,
+ display_name, len(self.users_in_room), None
+ ):
+ actions = [x for x in rule['actions'] if x != 'dont_notify']
+ if len(actions) > 0:
+ actions_by_user[uid] = actions
+ break
+ defer.returnValue(actions_by_user)
+
+ @staticmethod
+ def event_matches_rule(event, rule,
+ display_name, room_member_count, profile_tag):
+ matches = True
+
+ # passing the clock all the way into here is extremely awkward and push
+ # rules do not care about any of the relative timestamps, so we just
+ # pass 0 for the current time.
+ client_event = serialize_event(event, 0)
+
+ for cond in rule['conditions']:
+ matches &= PushRuleEvaluator._event_fulfills_condition(
+ client_event, cond, display_name, room_member_count, profile_tag
+ )
+ return matches
diff --git a/synapse/push/httppusher.py b/synapse/push/httppusher.py
index 5160775e59..28f1fab0e4 100644
--- a/synapse/push/httppusher.py
+++ b/synapse/push/httppusher.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2015 OpenMarket Ltd
+# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,13 +23,13 @@ logger = logging.getLogger(__name__)
class HttpPusher(Pusher):
- def __init__(self, _hs, profile_tag, user_name, app_id,
+ def __init__(self, _hs, profile_tag, user_id, app_id,
app_display_name, device_display_name, pushkey, pushkey_ts,
data, last_token, last_success, failing_since):
super(HttpPusher, self).__init__(
_hs,
profile_tag,
- user_name,
+ user_id,
app_id,
app_display_name,
device_display_name,
@@ -87,7 +87,7 @@ class HttpPusher(Pusher):
}
if event['type'] == 'm.room.member':
d['notification']['membership'] = event['content']['membership']
- d['notification']['user_is_target'] = event['state_key'] == self.user_name
+ d['notification']['user_is_target'] = event['state_key'] == self.user_id
if 'content' in event:
d['notification']['content'] = event['content']
diff --git a/synapse/push/push_rule_evaluator.py b/synapse/push/push_rule_evaluator.py
index 92c7fd048f..b0283743a2 100644
--- a/synapse/push/push_rule_evaluator.py
+++ b/synapse/push/push_rule_evaluator.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2015 OpenMarket Ltd
+# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -27,28 +27,28 @@ logger = logging.getLogger(__name__)
@defer.inlineCallbacks
-def evaluator_for_user_name_and_profile_tag(user_name, profile_tag, room_id, store):
- rawrules = yield store.get_push_rules_for_user(user_name)
- enabled_map = yield store.get_push_rules_enabled_for_user(user_name)
+def evaluator_for_user_id_and_profile_tag(user_id, profile_tag, room_id, store):
+ rawrules = yield store.get_push_rules_for_user(user_id)
+ enabled_map = yield store.get_push_rules_enabled_for_user(user_id)
our_member_event = yield store.get_current_state(
room_id=room_id,
event_type='m.room.member',
- state_key=user_name,
+ state_key=user_id,
)
defer.returnValue(PushRuleEvaluator(
- user_name, profile_tag, rawrules, enabled_map,
+ user_id, profile_tag, rawrules, enabled_map,
room_id, our_member_event, store
))
class PushRuleEvaluator:
- DEFAULT_ACTIONS = ['dont_notify']
+ DEFAULT_ACTIONS = []
INEQUALITY_EXPR = re.compile("^([=<>]*)([0-9]*)$")
- def __init__(self, user_name, profile_tag, raw_rules, enabled_map, room_id,
+ def __init__(self, user_id, profile_tag, raw_rules, enabled_map, room_id,
our_member_event, store):
- self.user_name = user_name
+ self.user_id = user_id
self.profile_tag = profile_tag
self.room_id = room_id
self.our_member_event = our_member_event
@@ -61,7 +61,7 @@ class PushRuleEvaluator:
rule['actions'] = json.loads(raw_rule['actions'])
rules.append(rule)
- user = UserID.from_string(self.user_name)
+ user = UserID.from_string(self.user_id)
self.rules = baserules.list_with_base_rules(rules, user)
self.enabled_map = enabled_map
@@ -83,9 +83,9 @@ class PushRuleEvaluator:
has configured both globally and per-room when we have the ability
to do such things.
"""
- if ev['user_id'] == self.user_name:
+ if ev['user_id'] == self.user_id:
# let's assume you probably know about messages you sent yourself
- defer.returnValue(['dont_notify'])
+ defer.returnValue([])
room_id = ev['room_id']
@@ -113,7 +113,8 @@ class PushRuleEvaluator:
for c in conditions:
matches &= self._event_fulfills_condition(
ev, c, display_name=my_display_name,
- room_member_count=room_member_count
+ room_member_count=room_member_count,
+ profile_tag=self.profile_tag
)
logger.debug(
"Rule %s %s",
@@ -123,19 +124,24 @@ class PushRuleEvaluator:
if len(actions) == 0:
logger.warn(
"Ignoring rule id %s with no actions for user %s",
- r['rule_id'], self.user_name
+ r['rule_id'], self.user_id
)
continue
if matches:
logger.info(
"%s matches for user %s, event %s",
- r['rule_id'], self.user_name, ev['event_id']
+ r['rule_id'], self.user_id, ev['event_id']
)
+
+ # filter out dont_notify as we treat an empty actions list
+ # as dont_notify, and this doesn't take up a row in our database
+ actions = [x for x in actions if x != 'dont_notify']
+
defer.returnValue(actions)
logger.info(
"No rules match for user %s, event %s",
- self.user_name, ev['event_id']
+ self.user_id, ev['event_id']
)
defer.returnValue(PushRuleEvaluator.DEFAULT_ACTIONS)
@@ -151,16 +157,18 @@ class PushRuleEvaluator:
re.sub(r'\\\-', '-', x.group(2)))), r)
return r
- def _event_fulfills_condition(self, ev, condition, display_name, room_member_count):
+ @staticmethod
+ def _event_fulfills_condition(ev, condition,
+ display_name, room_member_count, profile_tag):
if condition['kind'] == 'event_match':
if 'pattern' not in condition:
logger.warn("event_match condition with no pattern")
return False
# XXX: optimisation: cache our pattern regexps
if condition['key'] == 'content.body':
- r = r'\b%s\b' % self._glob_to_regexp(condition['pattern'])
+ r = r'\b%s\b' % PushRuleEvaluator._glob_to_regexp(condition['pattern'])
else:
- r = r'^%s$' % self._glob_to_regexp(condition['pattern'])
+ r = r'^%s$' % PushRuleEvaluator._glob_to_regexp(condition['pattern'])
val = _value_for_dotted_key(condition['key'], ev)
if val is None:
return False
@@ -169,7 +177,7 @@ class PushRuleEvaluator:
elif condition['kind'] == 'device':
if 'profile_tag' not in condition:
return True
- return condition['profile_tag'] == self.profile_tag
+ return condition['profile_tag'] == profile_tag
elif condition['kind'] == 'contains_display_name':
# This is special because display names can be different
diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py
index e012c565ee..12c4af14bd 100644
--- a/synapse/push/pusherpool.py
+++ b/synapse/push/pusherpool.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright 2015 OpenMarket Ltd
+# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -38,12 +38,12 @@ class PusherPool:
@defer.inlineCallbacks
def user_presence_changed(self, user, state):
- user_name = user.to_string()
+ user_id = user.to_string()
# until we have read receipts, pushers use this to reset a user's
# badge counters to zero
for p in self.pushers.values():
- if p.user_name == user_name:
+ if p.user_id == user_id:
yield p.presence_changed(state)
@defer.inlineCallbacks
@@ -52,14 +52,14 @@ class PusherPool:
self._start_pushers(pushers)
@defer.inlineCallbacks
- def add_pusher(self, user_name, access_token, profile_tag, kind, app_id,
+ def add_pusher(self, user_id, access_token, profile_tag, kind, app_id,
app_display_name, device_display_name, pushkey, lang, data):
# we try to create the pusher just to validate the config: it
# will then get pulled out of the database,
# recreated, added and started: this means we have only one
# code path adding pushers.
self._create_pusher({
- "user_name": user_name,
+ "user_name": user_id,
"kind": kind,
"profile_tag": profile_tag,
"app_id": app_id,
@@ -74,7 +74,7 @@ class PusherPool:
"failing_since": None
})
yield self._add_pusher_to_store(
- user_name, access_token, profile_tag, kind, app_id,
+ user_id, access_token, profile_tag, kind, app_id,
app_display_name, device_display_name,
pushkey, lang, data
)
@@ -109,11 +109,11 @@ class PusherPool:
self.remove_pusher(p['app_id'], p['pushkey'], p['user_name'])
@defer.inlineCallbacks
- def _add_pusher_to_store(self, user_name, access_token, profile_tag, kind,
+ def _add_pusher_to_store(self, user_id, access_token, profile_tag, kind,
app_id, app_display_name, device_display_name,
pushkey, lang, data):
yield self.store.add_pusher(
- user_name=user_name,
+ user_id=user_id,
access_token=access_token,
profile_tag=profile_tag,
kind=kind,
@@ -125,14 +125,14 @@ class PusherPool:
lang=lang,
data=data,
)
- self._refresh_pusher(app_id, pushkey, user_name)
+ self._refresh_pusher(app_id, pushkey, user_id)
def _create_pusher(self, pusherdict):
if pusherdict['kind'] == 'http':
return HttpPusher(
self.hs,
profile_tag=pusherdict['profile_tag'],
- user_name=pusherdict['user_name'],
+ user_id=pusherdict['user_name'],
app_id=pusherdict['app_id'],
app_display_name=pusherdict['app_display_name'],
device_display_name=pusherdict['device_display_name'],
@@ -150,14 +150,14 @@ class PusherPool:
)
@defer.inlineCallbacks
- def _refresh_pusher(self, app_id, pushkey, user_name):
+ def _refresh_pusher(self, app_id, pushkey, user_id):
resultlist = yield self.store.get_pushers_by_app_id_and_pushkey(
app_id, pushkey
)
p = None
for r in resultlist:
- if r['user_name'] == user_name:
+ if r['user_name'] == user_id:
p = r
if p:
@@ -186,12 +186,12 @@ class PusherPool:
logger.info("Started pushers")
@defer.inlineCallbacks
- def remove_pusher(self, app_id, pushkey, user_name):
- fullid = "%s:%s:%s" % (app_id, pushkey, user_name)
+ def remove_pusher(self, app_id, pushkey, user_id):
+ fullid = "%s:%s:%s" % (app_id, pushkey, user_id)
if fullid in self.pushers:
logger.info("Stopping pusher %s", fullid)
self.pushers[fullid].stop()
del self.pushers[fullid]
- yield self.store.delete_pusher_by_app_id_pushkey_user_name(
- app_id, pushkey, user_name
+ yield self.store.delete_pusher_by_app_id_pushkey_user_id(
+ app_id, pushkey, user_id
)
diff --git a/synapse/push/rulekinds.py b/synapse/push/rulekinds.py
index 4c591aa638..4cae48ac07 100644
--- a/synapse/push/rulekinds.py
+++ b/synapse/push/rulekinds.py
@@ -1,4 +1,4 @@
-# Copyright 2015 OpenMarket Ltd
+# Copyright 2015, 2016 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
|