summary refs log tree commit diff
path: root/synapse/storage/pusher.py
diff options
context:
space:
mode:
authorDavid Baker <dbkr@matrix.org>2014-11-21 12:21:00 +0000
committerDavid Baker <dbkr@matrix.org>2014-11-21 12:21:00 +0000
commiteb6aedf92c0fe467fd4724623262907ad78573bb (patch)
tree69b1f04952ffd7dd82b6643a56f1bc4e34c2087b /synapse/storage/pusher.py
parentMerge branch 'develop' into pushers (diff)
downloadsynapse-eb6aedf92c0fe467fd4724623262907ad78573bb.tar.xz
More work on pushers. Attempt to do HTTP pokes. Not sure if the actual HTTP pokes work or not yet but the retry semantics are pretty good.
Diffstat (limited to 'synapse/storage/pusher.py')
-rw-r--r--synapse/storage/pusher.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/synapse/storage/pusher.py b/synapse/storage/pusher.py
index 047a5f42d9..ce158c4b18 100644
--- a/synapse/storage/pusher.py
+++ b/synapse/storage/pusher.py
@@ -29,7 +29,8 @@ class PusherStore(SQLBaseStore):
     @defer.inlineCallbacks
     def get_all_pushers_after_id(self, min_id):
         sql = (
-            "SELECT id, user_name, kind, app, app_display_name, device_display_name, pushkey, data, last_token "
+            "SELECT id, user_name, kind, app, app_display_name, device_display_name, pushkey, data, "
+            "last_token, last_success, failing_since "
             "FROM pushers "
             "WHERE id > ?"
         )
@@ -46,8 +47,9 @@ class PusherStore(SQLBaseStore):
                 "device_display_name": r[5],
                 "pushkey": r[6],
                 "data": r[7],
-                "last_token": r[8]
-
+                "last_token": r[8],
+                "last_success": r[9],
+                "failing_since": r[10]
             }
             for r in rows
         ]
@@ -79,6 +81,20 @@ class PusherStore(SQLBaseStore):
                                       {'last_token': last_token}
         )
 
+    @defer.inlineCallbacks
+    def update_pusher_last_token_and_success(self, user_name, pushkey, last_token, last_success):
+        yield self._simple_update_one(PushersTable.table_name,
+                                      {'user_name': user_name, 'pushkey': pushkey},
+                                      {'last_token': last_token, 'last_success': last_success}
+        )
+
+    @defer.inlineCallbacks
+    def update_pusher_failing_since(self, user_name, pushkey, failing_since):
+        yield self._simple_update_one(PushersTable.table_name,
+                                      {'user_name': user_name, 'pushkey': pushkey},
+                                      {'failing_since': failing_since}
+        )
+
 
 class PushersTable(Table):
     table_name = "pushers"
@@ -92,7 +108,9 @@ class PushersTable(Table):
         "device_display_name",
         "pushkey",
         "data",
-        "last_token"
+        "last_token",
+        "last_success",
+        "failing_since"
     ]
 
     EntryType = collections.namedtuple("PusherEntry", fields)
\ No newline at end of file