summary refs log tree commit diff
path: root/synapse/storage/pusher.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2015-01-20 11:49:48 +0000
committerDavid Baker <dave@matrix.org>2015-01-20 11:49:48 +0000
commitafb714f7bebf88ac27eac018cffa2078e2723310 (patch)
treec65a60cc08b0c5335a25b946f49255cbe4468202 /synapse/storage/pusher.py
parentRequire device language when adding a pusher. (diff)
downloadsynapse-afb714f7bebf88ac27eac018cffa2078e2723310.tar.xz
add instance_handles to pushers so we have a way to refer to them even if the push token changes.
Diffstat (limited to 'synapse/storage/pusher.py')
-rw-r--r--synapse/storage/pusher.py46
1 files changed, 25 insertions, 21 deletions
diff --git a/synapse/storage/pusher.py b/synapse/storage/pusher.py
index 4eb30c7bdf..113cdc8a8e 100644
--- a/synapse/storage/pusher.py
+++ b/synapse/storage/pusher.py
@@ -29,7 +29,7 @@ class PusherStore(SQLBaseStore):
     @defer.inlineCallbacks
     def get_pushers_by_app_id_and_pushkey(self, app_id_and_pushkey):
         sql = (
-            "SELECT id, user_name, kind, app_id,"
+            "SELECT id, user_name, kind, instance_handle, app_id,"
             "app_display_name, device_display_name, pushkey, ts, data, "
             "last_token, last_success, failing_since "
             "FROM pushers "
@@ -45,15 +45,16 @@ class PusherStore(SQLBaseStore):
                 "id": r[0],
                 "user_name": r[1],
                 "kind": r[2],
-                "app_id": r[3],
-                "app_display_name": r[4],
-                "device_display_name": r[5],
-                "pushkey": r[6],
-                "pushkey_ts": r[7],
-                "data": r[8],
-                "last_token": r[9],
-                "last_success": r[10],
-                "failing_since": r[11]
+                "instance_handle": r[3],
+                "app_id": r[4],
+                "app_display_name": r[5],
+                "device_display_name": r[6],
+                "pushkey": r[7],
+                "pushkey_ts": r[8],
+                "data": r[9],
+                "last_token": r[10],
+                "last_success": r[11],
+                "failing_since": r[12]
             }
             for r in rows
         ]
@@ -63,7 +64,7 @@ class PusherStore(SQLBaseStore):
     @defer.inlineCallbacks
     def get_all_pushers(self):
         sql = (
-            "SELECT id, user_name, kind, app_id,"
+            "SELECT id, user_name, kind, instance_handle, app_id,"
             "app_display_name, device_display_name, pushkey, ts, data, "
             "last_token, last_success, failing_since "
             "FROM pushers"
@@ -76,15 +77,16 @@ class PusherStore(SQLBaseStore):
                 "id": r[0],
                 "user_name": r[1],
                 "kind": r[2],
-                "app_id": r[3],
-                "app_display_name": r[4],
-                "device_display_name": r[5],
-                "pushkey": r[6],
-                "pushkey_ts": r[7],
-                "data": r[8],
-                "last_token": r[9],
-                "last_success": r[10],
-                "failing_since": r[11]
+                "instance_handle": r[3],
+                "app_id": r[4],
+                "app_display_name": r[5],
+                "device_display_name": r[6],
+                "pushkey": r[7],
+                "pushkey_ts": r[8],
+                "data": r[9],
+                "last_token": r[10],
+                "last_success": r[11],
+                "failing_since": r[12]
             }
             for r in rows
         ]
@@ -92,7 +94,7 @@ class PusherStore(SQLBaseStore):
         defer.returnValue(ret)
 
     @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, pushkey_ts, lang, data):
         try:
@@ -105,6 +107,7 @@ class PusherStore(SQLBaseStore):
                 dict(
                     user_name=user_name,
                     kind=kind,
+                    instance_handle=instance_handle,
                     app_display_name=app_display_name,
                     device_display_name=device_display_name,
                     ts=pushkey_ts,
@@ -155,6 +158,7 @@ class PushersTable(Table):
         "id",
         "user_name",
         "kind",
+        "instance_handle",
         "app_id",
         "app_display_name",
         "device_display_name",