Fixed the looping bug on killed thread

This commit is contained in:
Darks 2022-12-14 22:48:12 +01:00
parent b4fa6de4b8
commit f77f92213d
1 changed files with 2 additions and 1 deletions

View File

@ -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: