From 527d548743a48934465da355a110b4a71079cbba Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 28 Aug 2018 15:32:50 +0100 Subject: Seperate .waiting_send() and throttle logic --- IRCBot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'IRCBot.py') diff --git a/IRCBot.py b/IRCBot.py index df8dce83..58e1a604 100644 --- a/IRCBot.py +++ b/IRCBot.py @@ -76,11 +76,11 @@ class Bot(object): timer.call() if timer.done(): self.timer_setting_remove(timer) - def next_write(self): + def next_send(self): next = None for server in self.servers.values(): - timeout = server.send_timeout() - if not next or timeout < next: + timeout = server.send_throttle_timeout() + if server.waiting_send() and (not next or timeout < next): next = timeout if next == None: return None @@ -90,7 +90,7 @@ class Bot(object): def get_poll_timeout(self): next_timer = self.next_timer() or 30 - next_write = self.next_write() or 30 + next_write = self.next_send() or 30 return min(next_timer, next_write) def register_read(self, server): @@ -171,6 +171,6 @@ class Bot(object): print("disconnected from %s, reconnecting in %d seconds" % ( str(server), reconnect_delay)) - elif server.waiting_send(): + elif server.waiting_send() and server.throttle_done(): self.register_both(server) self.lock.release() -- cgit v1.3.1-10-gc9f91