MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / trigger_shutdown

Function trigger_shutdown

scripts/dashboard.py:621–639  ·  view source on GitHub ↗

Stop the server and exit when there are no more clients.

(reason: str = "")

Source from the content-addressed store, hash-verified

619
620
621def trigger_shutdown(reason: str = ""):
622 """Stop the server and exit when there are no more clients."""
623 if reason:
624 print(reason)
625 if shutdown_event.is_set():
626 return
627 shutdown_event.set()
628
629 def _stop():
630 # Give the watcher loop a moment to exit
631 time.sleep(0.2)
632 try:
633 socketio.stop()
634 except Exception:
635 pass
636 # Ensure process exits
637 sys.exit(0)
638
639 threading.Thread(target=_stop, daemon=True).start()
640
641
642HTML_TEMPLATE = """

Callers 3

handle_disconnectFunction · 0.85
handle_shutdownFunction · 0.85
signal_handlerFunction · 0.85

Calls 1

startMethod · 0.45

Tested by

no test coverage detected