Fixed starting and stopping rsi in the cli. Tidied up print statements, converted to logging. Tidied up comments.

This commit is contained in:
Adam 2025-04-26 21:08:12 +01:00
parent c461233728
commit 4bac836d6e

View File

@ -54,20 +54,23 @@ class RSIClient:
def stop(self):
"""Stop the network process and the client thread safely."""
logging.info("Stopping RSI Client...")
logging.info("🛑 Stopping RSI Client...")
self.running = False
self.stop_event.set()
self.stop_event.set() # ✅ Tell network process to exit nicely
if self.network_process and self.network_process.is_alive():
self.network_process.join(timeout=3) # ✅ Give it time to shutdown
if self.network_process.is_alive():
logging.warning("⚠️ Forcing network process termination...")
self.network_process.terminate()
self.network_process.join()
if hasattr(self, "thread") and self.thread and self.thread.is_alive():
self.thread.join()
self.thread = None
self.reconnect()
logging.info("RSI Client Stopped")
logging.info("RSI Client Stopped")
def reconnect(self):
"""Reconnects the network process safely."""