Decode the data json in the storage layer (was moved but this part was missed)

This commit is contained in:
David Baker 2015-04-29 17:13:51 +01:00
parent f8c30faf25
commit 12d381bd5d
2 changed files with 14 additions and 1 deletions

View File

@ -170,7 +170,11 @@ class PusherPool:
def _start_pushers(self, pushers): def _start_pushers(self, pushers):
logger.info("Starting %d pushers", len(pushers)) logger.info("Starting %d pushers", len(pushers))
for pusherdict in 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: if p:
fullid = "%s:%s:%s" % ( fullid = "%s:%s:%s" % (
pusherdict['app_id'], pusherdict['app_id'],

View File

@ -21,6 +21,7 @@ from synapse.api.errors import StoreError
from syutil.jsonutil import encode_canonical_json from syutil.jsonutil import encode_canonical_json
import logging import logging
import simplejson as json
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -48,6 +49,14 @@ class PusherStore(SQLBaseStore):
) )
rows = yield self._execute_and_decode("get_all_pushers", sql) 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) defer.returnValue(rows)