More robust logic on the bus in case the message failed to parse (prevents the application from crashing)
This commit is contained in:
parent
a650840429
commit
1e972ded99
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue