From 9673963a8d7b940a4ffc71d635c9b56fb681d1fd Mon Sep 17 00:00:00 2001 From: jesopo Date: Sun, 23 Jun 2019 18:53:25 +0100 Subject: [PATCH] shift _check() call to event loop function so read_loop needn't call trigger() --- src/IRCBot.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/IRCBot.py b/src/IRCBot.py index 7d806597..0077e8ea 100644 --- a/src/IRCBot.py +++ b/src/IRCBot.py @@ -275,7 +275,8 @@ class Bot(object): self.log.warn("No servers, exiting") break - kill = False + self._check() + item = self._event_queue.get(block=True, timeout=None) if item.type == TriggerEventType.Action: @@ -337,7 +338,6 @@ class Bot(object): while self.running: events = self._read_poll.poll(self.get_poll_timeout()) - self.trigger(self._check, False) for fd, event in events: if fd == self._rtrigger_server.fileno(): @@ -357,8 +357,9 @@ class Bot(object): server.disconnect() continue - self.trigger(self._post_read_factory(server, lines), - False) + event_item = TriggerEvent(TriggerEventType.Action, + self._post_read_factory(server, lines)) + self._event_queue.put(event_item) elif event & select.POLLHUP: self.log.warn("Recieved POLLHUP for %s", [str(server)]) server.disconnect()