mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-23 17:26:30 +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:
|
Returns:
|
||||||
bool: True if the WebSocket server has started on the specified port within the maximum time limit, False otherwise.
|
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
|
max_time = 5
|
||||||
start = time.time()
|
start = time.time()
|
||||||
while True:
|
while True:
|
||||||
@@ -241,7 +242,7 @@ class Web(bonsai.core.tool.Web):
|
|||||||
try:
|
try:
|
||||||
with open(pid_file, "r") as f:
|
with open(pid_file, "r") as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
if port in data.values():
|
if data.get(str(pid)) == port:
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user