From f77f92213d15441b20b2428110e4cc9af2dcd42a Mon Sep 17 00:00:00 2001 From: Darks Date: Wed, 14 Dec 2022 22:48:12 +0100 Subject: [PATCH] Fixed the looping bug on killed thread --- shoutbox.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shoutbox.py b/shoutbox.py index 3b02689..c7f2597 100644 --- a/shoutbox.py +++ b/shoutbox.py @@ -117,10 +117,11 @@ class Shoutbox(object): logging.info(f"matched {event.__name__}") callback(message) # kill afk clients - for c in self.irc_clients.values(): + for k, c in self.irc_clients.items(): if datetime.datetime.now() - c[1] > datetime.timedelta(hours=1): logging.info(f"killing {c[0].nick}") c[0].stop() + self.irc_clients.pop(k) except Exception as e: logging.error(f"Faillure in Shoutbox thread {e}") finally: