From 1e972ded9954b57513603e7a50f156290abdc7f8 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 9 Sep 2020 02:15:35 +0200 Subject: [PATCH] More robust logic on the bus in case the message failed to parse (prevents the application from crashing) --- platypush/bus/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platypush/bus/__init__.py b/platypush/bus/__init__.py index 64269cf55a..257035d2a3 100644 --- a/platypush/bus/__init__.py +++ b/platypush/bus/__init__.py @@ -58,7 +58,8 @@ class Bus(object): stop = False while not stop: msg = self.get() - if msg.timestamp and time.time() - msg.timestamp > self._MSG_EXPIRY_TIMEOUT: + timestamp = msg.timestamp if hasattr(msg, 'timestamp') else msg.get('timestamp') + if timestamp and time.time() - timestamp > self._MSG_EXPIRY_TIMEOUT: logger.debug('{} seconds old message on the bus expired, ignoring it: {}'. format(int(time.time()-msg.timestamp), msg)) continue