From 88549f9faa2df62a72f5cfb94aed085e9e55377f Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 29 May 2020 19:41:09 +0200 Subject: [PATCH] Socket: Move call to supybot.drivers.poll outside the critical section. It may do some non-trivial stuff (eg. calling registry callbacks); and the less code in the locked-section the better. --- src/drivers/Socket.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/drivers/Socket.py b/src/drivers/Socket.py index 72156767a..b9e9938d9 100644 --- a/src/drivers/Socket.py +++ b/src/drivers/Socket.py @@ -145,6 +145,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin): @classmethod def _select(cls): + timeout = conf.supybot.drivers.poll() try: if not cls._selecting.acquire(blocking=False): # there's already a thread running this code, abort. @@ -162,7 +163,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin): if not cls._instances: return rlist, wlist, xlist = select.select([x.conn for x in cls._instances], - [], [], conf.supybot.drivers.poll()) + [], [], timeout) for instance in cls._instances: if instance.conn in rlist: instance._read()