mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
make has_started check for both pid and port
this solves the issue when a user has not killed a previous server so the port of that server wasn't removed from the pid file, which would make has_started return true even if server hasn't started yet.
This commit is contained in:
@@ -231,6 +231,7 @@ class Web(bonsai.core.tool.Web):
|
||||
Returns:
|
||||
bool: True if the WebSocket server has started on the specified port within the maximum time limit, False otherwise.
|
||||
"""
|
||||
pid = ws_process.pid
|
||||
max_time = 5
|
||||
start = time.time()
|
||||
while True:
|
||||
@@ -241,7 +242,7 @@ class Web(bonsai.core.tool.Web):
|
||||
try:
|
||||
with open(pid_file, "r") as f:
|
||||
data = json.load(f)
|
||||
if port in data.values():
|
||||
if data.get(str(pid)) == port:
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user