Skip to content

Commit

Permalink
ENH: socket binding (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
UranusSeven committed Jul 11, 2023
1 parent 5ea9c05 commit 07c2e30
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions xinference/deploy/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ async def start_supervisor_components(address: str, host: str, port: int):
sock.bind((host, port))
sockets.append(sock)
except OSError:
# compare the reference to differentiate between the cases where the user specify the
# default port and the user does not specify the port.
if port is XINFERENCE_DEFAULT_ENDPOINT_PORT:
while True:
try:
Expand All @@ -48,9 +50,9 @@ async def start_supervisor_components(address: str, host: str, port: int):
sockets.append(sock)
break
except OSError:
pass
logger.warning("Failed to create socket with port %d", port)
else:
raise OSError
raise

restful_actor = await xo.create_actor(
RESTfulAPIActor,
Expand Down

0 comments on commit 07c2e30

Please sign in to comment.