Skip to content

Commit

Permalink
Check for newline in port file
Browse files Browse the repository at this point in the history
  • Loading branch information
fxgst committed Nov 19, 2024
1 parent ad078be commit 4b45304
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pocket_ic/pocket_ic_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ def set_blob_store_entry(self, blob: bytes, compression: Optional[str]) -> str:
return response.text

def _get_url(self, port_file_path: int) -> str:
stop_at = time.time() + 10 # Wait for the ready file for 10 seconds
stop_at = time.time() + 10 # Wait for the port file for 10 seconds

while True:
if os.path.isfile(port_file_path):
with open(port_file_path, "r", encoding="utf-8") as port_file:
port = port_file.readline().strip()
if port:
return f"http://127.0.0.1:{port}"
port = port_file.readline()
if "\n" in port:
return f"http://127.0.0.1:{port.strip()}"

time.sleep(0.02) # wait for 20ms

Expand Down

0 comments on commit 4b45304

Please sign in to comment.