From ca21c914ef982e08c345cf6da7f018c474eb563c Mon Sep 17 00:00:00 2001 From: Jordyn Date: Sat, 14 Mar 2026 04:43:40 -0500 Subject: [PATCH] Avoid 100% CPU loop during heavy usage --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 68692e6..c74100d 100755 --- a/main.py +++ b/main.py @@ -120,7 +120,7 @@ class Server(): # Can't use die because we have no connection... just quit I suppose self._going_down.set() raise SystemExit(1) - + print("[SENDTHREAD] Quitting due to thread condition!") # This is the function used to process messages from the server @@ -338,9 +338,9 @@ class Server(): self.privmsg(target_channel, line) - # Wait is required to fetch exit code - proc.wait() - self.privmsg(target_channel, f"CMD {cmd} exited with returncode {proc.returncode}") + # Break if our child exits for any reason + if proc.poll(): + break if __name__ == "__main__": serv = Server(**config.user, **config.bot)