chg: Cleanup website status in monitoring

pull/476/head
Raphaël Vinot 2022-07-28 15:33:04 +02:00
parent 37212a5d3e
commit 484a5d5d89
1 changed files with 10 additions and 1 deletions

View File

@ -74,7 +74,16 @@ class Monitoring():
@property
def tree_cache(self):
return self.redis_cache.hgetall('tree_cache')
to_return = {}
for pid_name, value in self.redis_cache.hgetall('tree_cache').items():
pid, name = pid_name.split('|', 1)
try:
os.kill(int(pid), 0)
except OSError:
self.redis_cache.hdel('tree_cache', pid_name)
continue
to_return[pid_name] = value
return to_return
if __name__ == '__main__':