From c17484b0ec0e4236c21dddebb8724012d06047f1 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 14 Dec 2018 19:07:39 +0000 Subject: [PATCH] Don't constantly retry socket --- catfish/worker/server.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/catfish/worker/server.py b/catfish/worker/server.py index 37b3af0..8d7c776 100644 --- a/catfish/worker/server.py +++ b/catfish/worker/server.py @@ -22,13 +22,7 @@ WORKER_SERVER_SOCKET = os.path.join(BASE_SOCKET_DIR, "catfish.sock") def send_to_server(payload): with socket.socket(socket.AF_UNIX, type=socket.SOCK_STREAM) as sock: - while True: - try: - sock.connect(WORKER_SERVER_SOCKET) - break - except ConnectionRefusedError: - time.sleep(0.1) - + sock.connect(WORKER_SERVER_SOCKET) sock.sendall(ujson.dumps(payload).encode() + NEW_LINE) return read_all_from_socket(sock)