Commit d5e99000 authored by Alan Marchiori's avatar Alan Marchiori

added retry logic on socket connection

parent 9914f316
......@@ -189,11 +189,15 @@ def main():
#shutdown connection
skt.shutdown(socket.SHUT_RDWR)
skt.close()
skt.close()
skt = None
time.sleep(database_update_time_gap)
# reopen socket
skt = pakbus.open_socket(host, port, timeout)
# reopen socket
while skt == None:
skt = pakbus.open_socket(host, port, timeout)
if skt == None:
self.log.error("Failed to reopen socket, retry")
except socket.error as msg:
logging.error("Socket died with: {}".format(msg))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment