Skip to content

Commit 31035cf

Browse files
committed
catch dbus exception and continue iteration
1 parent a39ac29 commit 31035cf

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/systemd_monitor/journald_worker.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import copy
1616
import datetime
17+
import dbus
1718
import json
1819
import logging
1920
import subprocess
@@ -112,11 +113,15 @@ def run_iterate(self):
112113
if 'UNIT' not in data:
113114
continue
114115
# update internal storage
116+
try:
117+
unit_data = self.__systemd.get_unit(data['UNIT'])
118+
except dbus.DBusException:
119+
self.__logger.warning('DBus exception recieved', exc_info=True)
120+
continue
115121
with self.__lock:
116-
self.__states[
117-
data['UNIT']] = self.__systemd.get_unit(data['UNIT'])
122+
self.__states[data['UNIT']] = unit_data
118123
self.__lst = datetime.datetime.utcnow()
119-
yield data['UNIT'], self.__states[data['UNIT']]
124+
yield data['UNIT'], unit_data
120125
except Exception:
121126
self.__logger.warning('Exception recieved', exc_info=True)
122127
self.__status = False

0 commit comments

Comments
 (0)