motan: Improve handling of errors during data subscriptions

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2021-09-26 12:24:40 -04:00
parent 1eecd412ef
commit c543b00aa6
1 changed files with 4 additions and 0 deletions

View File

@ -159,6 +159,10 @@ class DataLogger:
{"sensor": aname})
def handle_dump(self, msg, raw_msg):
msg_id = msg["id"]
if "result" not in msg:
self.error("Unable to subscribe to '%s': %s"
% (msg_id, msg.get("error", {}).get("message", "")))
return
self.db.setdefault("subscriptions", {})[msg_id] = msg["result"]
def flush_index(self):
self.db['file_position'] = self.logger.flush()