Messages should always be posted to the Redis bus in valid JSON format - no need for ast.literal_eval fallback

This commit is contained in:
Fabio Manganiello 2021-03-12 20:52:01 +01:00
parent 347a4d2555
commit adb472da7f

View file

@ -1,5 +1,3 @@
import ast
import json
import logging import logging
import threading import threading
@ -39,13 +37,7 @@ class RedisBus(Bus):
if not msg or msg[1] is None: if not msg or msg[1] is None:
return return
msg = msg[1].decode('utf-8') msg = Message.build(msg[1].decode('utf-8'))
try:
msg = json.loads(msg)
except json.decoder.JSONDecodeError:
msg = ast.literal_eval(msg)
msg = Message.build(msg)
except Exception as e: except Exception as e:
logger.exception(e) logger.exception(e)