Skip to content

Commit 92a008e

Browse files
committed
switch to time.sleep() until servers start, comment out debugging print statements.
1 parent d11bd6e commit 92a008e

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

vpython/no_notebook.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import copy
1515
import socket
1616
import multiprocessing
17+
import time
1718

1819
import signal
1920
from urllib.parse import unquote
@@ -38,7 +39,8 @@ def run(*args, **kwargs):
3839
try:
3940
run_old(*args, **kwargs)
4041
except (KeyboardInterrupt, SystemExit):
41-
print("VPython server stopped.")
42+
pass
43+
# ("VPython server stopped.")
4244
except:
4345
raise
4446
threading.Thread.run = run
@@ -49,7 +51,7 @@ def run(*args, **kwargs):
4951

5052
# Check for Ctrl+C. SIGINT will also be sent by our code if WServer is closed.
5153
def signal_handler(signal, frame):
52-
print("in signal handler, calling stop server")
54+
#print("in signal handler, calling stop server")
5355
stop_server()
5456

5557
signal.signal(signal.SIGINT, signal_handler)
@@ -342,7 +344,7 @@ def start_websocket_server():
342344

343345
def stop_server():
344346
"""Shuts down all threads and exits cleanly."""
345-
print("in stop server")
347+
#print("in stop server")
346348
global __server
347349
__server.shutdown()
348350

@@ -364,20 +366,21 @@ def stop_server():
364366
raise KeyboardInterrupt
365367

366368
if threading.main_thread().is_alive():
367-
print("main is alive...")
369+
#print("main is alive...")
368370
sys.exit(0)
369371
else:
370372
#
371373
# check to see if the event loop is still going, if so join it.
372374
#
373-
print("main is dead..")
375+
#print("main is dead..")
374376
if __t.is_alive():
375-
print("__t is alive still")
377+
#print("__t is alive still")
376378
if threading.get_ident() != __t.ident:
377-
print("but it's not my thread, so I'll join...")
379+
#print("but it's not my thread, so I'll join...")
378380
__t.join()
379381
else:
380-
print("__t is alive, but that's my thread! So skip it.")
382+
#print("__t is alive, but that's my thread! So skip it.")
383+
pass
381384
else:
382385
if makeDaemonic:
383386
sys.exit(0)
@@ -390,7 +393,7 @@ def stop_server():
390393
GW = GlowWidget()
391394

392395
while not (httpserving and websocketserving): # try to make sure setup is complete
393-
rate(60)
396+
time.sleep(0.1)
394397

395398

396399
# Dummy variable to import

0 commit comments

Comments
 (0)