add instance_handles to pushers so we have a way to refer to them even if the push token changes.

This commit is contained in:
David Baker 2015-01-20 11:49:48 +00:00
parent 2d2953cf5f
commit afb714f7be
7 changed files with 39 additions and 27 deletions

View file

@ -40,7 +40,7 @@ class PusherPool:
self._start_pushers(pushers)
@defer.inlineCallbacks
def add_pusher(self, user_name, kind, app_id,
def add_pusher(self, user_name, instance_handle, 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,
@ -49,6 +49,7 @@ class PusherPool:
self._create_pusher({
"user_name": user_name,
"kind": kind,
"instance_handle": instance_handle,
"app_id": app_id,
"app_display_name": app_display_name,
"device_display_name": device_display_name,
@ -61,17 +62,18 @@ class PusherPool:
"failing_since": None
})
yield self._add_pusher_to_store(
user_name, kind, app_id,
user_name, instance_handle, kind, app_id,
app_display_name, device_display_name,
pushkey, lang, data
)
@defer.inlineCallbacks
def _add_pusher_to_store(self, user_name, kind, app_id,
def _add_pusher_to_store(self, user_name, instance_handle, kind, app_id,
app_display_name, device_display_name,
pushkey, lang, data):
yield self.store.add_pusher(
user_name=user_name,
instance_handle=instance_handle,
kind=kind,
app_id=app_id,
app_display_name=app_display_name,
@ -87,6 +89,7 @@ class PusherPool:
if pusherdict['kind'] == 'http':
return HttpPusher(
self.hs,
instance_handle=pusherdict['instance_handle'],
user_name=pusherdict['user_name'],
app_id=pusherdict['app_id'],
app_display_name=pusherdict['app_display_name'],