Skip to content

Commit

Permalink
v1.1.1 - fix issue resolving docker dns names (e.g. db)
Browse files Browse the repository at this point in the history
  • Loading branch information
clarketm committed Jan 20, 2019
1 parent f14f7d2 commit 90c19ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion wait_for_it/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.0"
__version__ = "1.1.1"
14 changes: 9 additions & 5 deletions wait_for_it/wait_for_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
import sys
import time
from urllib.parse import urlparse
from wait_for_it import __version__

import click

from wait_for_it import __version__


@click.command()
@click.help_option("-h", "--help")
Expand Down Expand Up @@ -74,17 +75,20 @@ def _handle_timeout(signum, frame):

t1 = time.time()

try:
while True:
while True:
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s = sock.connect_ex((host, port))
if s == 0:
seconds = round(time.time() - t1)
print(f"{friendly_name} is available after {seconds} seconds")
break
except socket.gaierror:
pass
finally:
time.sleep(1)
finally:
signal.alarm(0)

signal.alarm(0)


if __name__ == "__main__":
Expand Down

0 comments on commit 90c19ee

Please sign in to comment.