From 57baa0c64a8ed5b25811991fa6abf0b3522b1593 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 29 Jun 2018 11:09:28 +0200 Subject: [PATCH] Try to decode the message event if it's not a Platypush message --- platypush/backend/redis.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platypush/backend/redis.py b/platypush/backend/redis.py index 6e9db349..1fe93f07 100644 --- a/platypush/backend/redis.py +++ b/platypush/backend/redis.py @@ -48,8 +48,14 @@ class RedisBackend(Backend): try: msg = Message.build(json.loads(msg)) except: - import ast - msg = Message.build(ast.literal_eval(msg)) + try: + import ast + msg = Message.build(ast.literal_eval(msg)) + except: + try: + msg = json.loads(msg) + except Exception as e: + self.logger.exception(e) return msg