From db2b883a6d1b70fd9a5d678fd7fd106beb0c5489 Mon Sep 17 00:00:00 2001 From: Shiz Date: Thu, 30 Jan 2014 02:55:09 +0100 Subject: [PATCH] Don't bother waiting for messages if we already have one in queue. --- pydle/connection.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pydle/connection.py b/pydle/connection.py index 9c49bfd..b8513fe 100644 --- a/pydle/connection.py +++ b/pydle/connection.py @@ -436,6 +436,9 @@ class ConnectionPool: sockets = { conn.socket: conn for conn in self.connections if conn.connected } found = False + if self.has_message(): + return + while not found: # Wait forever until a socket becomes readable. readable, writable, error = select.select(sockets.keys(), [], [])