From 0d79de004d84cb78f8e4cd8e11b79a69dfbd23a9 Mon Sep 17 00:00:00 2001 From: fly Date: Thu, 13 Feb 2020 15:16:38 +0000 Subject: [PATCH] Close socket earlier Signed-off-by: fly --- worldbuild-worker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldbuild-worker.py b/worldbuild-worker.py index e6b9264..f032d96 100755 --- a/worldbuild-worker.py +++ b/worldbuild-worker.py @@ -92,6 +92,7 @@ def get_job(action): sock.connect((host, port)) sock.send(("get " + action).encode()) msg = sock.recv(128) + sock.close() msg = msg.decode() match = re.match(r"n-pole|s-pole|[ew]\d{3}[ns]\d{2}|None", msg) if match != None: @@ -103,7 +104,6 @@ def get_job(action): print("Recived invalid job. Retrying in 10 seconds...") sleep(10) ret = get_job(action) - sock.close() return ret except IOError: print("Unable to get job. Retrying in 10 seconds...")