Skip to content

Commit a39ac29

Browse files
committed
drop code dups
1 parent bcd5d38 commit a39ac29

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

src/systemd_monitor/journald_worker.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -89,30 +89,8 @@ def run(self):
8989
'''
9090
run thread
9191
'''
92-
self.__load_states()
93-
while self.__should_run:
94-
try:
95-
for line in self.__get_journal():
96-
self.__status = True
97-
# exit on no actions
98-
if not self.__should_run:
99-
break
100-
# parse line
101-
if isinstance(line, bytes):
102-
line = line.decode('utf8')
103-
data = json.loads(line)
104-
# check if it is unit related infomation
105-
if 'UNIT' not in data:
106-
continue
107-
# update internal storage
108-
with self.__lock:
109-
self.__states[
110-
data['UNIT']] = self.__systemd.get_unit(data['UNIT'])
111-
self.__lst = datetime.datetime.utcnow()
112-
except Exception:
113-
self.__logger.warning('Exception recieved', exc_info=True)
114-
self.__status = False
115-
time.sleep(60)
92+
for unit, state in self.run_iterate():
93+
pass
11694

11795
def run_iterate(self):
11896
'''

0 commit comments

Comments
 (0)