Don't bail out if write fails, keep retrying

This commit is contained in:
Joshua Boniface 2021-07-19 13:09:36 -04:00
parent 6ead21a308
commit 4d6842f942
1 changed files with 9 additions and 2 deletions

View File

@ -227,8 +227,15 @@ class ZookeeperLogger(Thread):
date = '' date = ''
# Add the message to the deque # Add the message to the deque
logs.append(f'{date}{message}') logs.append(f'{date}{message}')
while True:
try:
# Write the updated messages into Zookeeper # Write the updated messages into Zookeeper
self.zkhandler.write([(('logs.messages', self.node), '\n'.join(logs))]) self.zkhandler.write([(('logs.messages', self.node), '\n'.join(logs))])
break
except Exception:
sleep(0.1)
continue
return return
def stop(self): def stop(self):