summary refs log tree commit diff
path: root/synapse/storage/pusher.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-29 18:03:42 +0100
committerErik Johnston <erik@matrix.org>2015-04-29 18:03:42 +0100
commit09177f4f2e237aa042cdb21cec91f4374d072332 (patch)
treeb95cd0a6fed25c8174cf2f867ac194ea7b75dd21 /synapse/storage/pusher.py
parentWe store pusher data as bytes (diff)
downloadsynapse-09177f4f2e237aa042cdb21cec91f4374d072332.tar.xz
Decode buffers in same thread
Diffstat (limited to 'synapse/storage/pusher.py')
-rw-r--r--synapse/storage/pusher.py32
1 files changed, 19 insertions, 13 deletions
diff --git a/synapse/storage/pusher.py b/synapse/storage/pusher.py
index 57690c3ef5..c51e08fa27 100644
--- a/synapse/storage/pusher.py
+++ b/synapse/storage/pusher.py
@@ -44,20 +44,26 @@ class PusherStore(SQLBaseStore):
 
     @defer.inlineCallbacks
     def get_all_pushers(self):
-        sql = (
-            "SELECT * FROM pushers"
+        def get_pushers(txn):
+            txn.execute("SELECT * FROM pushers")
+            rows = self.cursor_to_dict(txn)
+
+            for r in rows:
+                dataJson = r['data']
+                r['data'] = None
+                try:
+                    r['data'] = json.loads(str(dataJson).decode("UTF8"))
+                except Exception as e:
+                    logger.warn(
+                        "Invalid JSON in data for pusher %d: %s, %s",
+                        r['id'], dataJson, e.message,
+                    )
+                    pass
+
+        rows = yield self.runInteraction(
+            get_pushers,
+            desc="get_all_pushers",
         )
-
-        rows = yield self._execute_and_decode("get_all_pushers", sql)
-        for r in rows:
-            dataJson = r['data']
-            r['data'] = None
-            try:
-                r['data'] = json.loads(str(dataJson).decode("UTF8"))
-            except:
-                logger.warn("Invalid JSON in data for pusher %d: %s", r['id'], dataJson)
-                pass
-
         defer.returnValue(rows)
 
     @defer.inlineCallbacks