From f8b51c82113f1e6b22dbc99659784e2bb3ec029c Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 24 Mar 2018 23:58:40 +0200 Subject: Fix: lib.py wait_for_port to actually work Previously, if the timing was just right, the function would try to connect to the port before gunicorn had opened it, and handled the resulting excption badly. Should now handle it correctly. --- yarns/lib.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'yarns') diff --git a/yarns/lib.py b/yarns/lib.py index 0914b00..d57e11f 100644 --- a/yarns/lib.py +++ b/yarns/lib.py @@ -59,6 +59,8 @@ def wait_for_port(port): try: s = socket.socket() s.connect(('127.0.0.1', port)) + except socket.error: + time.sleep(0.1) except OSError as e: raise else: -- cgit v1.2.1