From 12d381bd5da730d9d4fb2aebcc9fb3d83f9456a7 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 29 Apr 2015 17:13:51 +0100 Subject: [PATCH] Decode the data json in the storage layer (was moved but this part was missed) --- synapse/push/pusherpool.py | 6 +++++- synapse/storage/pusher.py | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py index 58fe6ad747..571d8b2f82 100644 --- a/synapse/push/pusherpool.py +++ b/synapse/push/pusherpool.py @@ -170,7 +170,11 @@ class PusherPool: def _start_pushers(self, pushers): logger.info("Starting %d pushers", len(pushers)) for pusherdict in pushers: - p = self._create_pusher(pusherdict) + try: + p = self._create_pusher(pusherdict) + except PusherConfigException: + logger.exception("Couldn't start a pusher: caught PusherConfigException") + continue if p: fullid = "%s:%s:%s" % ( pusherdict['app_id'], diff --git a/synapse/storage/pusher.py b/synapse/storage/pusher.py index 2582a1da66..feb2870dfe 100644 --- a/synapse/storage/pusher.py +++ b/synapse/storage/pusher.py @@ -21,6 +21,7 @@ from synapse.api.errors import StoreError from syutil.jsonutil import encode_canonical_json import logging +import simplejson as json logger = logging.getLogger(__name__) @@ -48,6 +49,14 @@ class PusherStore(SQLBaseStore): ) 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(dataJson) + except: + logger.warn("Invalid JSON in data for pusher %d: %s", r['id'], dataJson) + pass defer.returnValue(rows)