mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-22 18:39:31 +01:00
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.
This commit is contained in:
parent
aa2f9202ec
commit
88549f9faa
@ -145,6 +145,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _select(cls):
|
def _select(cls):
|
||||||
|
timeout = conf.supybot.drivers.poll()
|
||||||
try:
|
try:
|
||||||
if not cls._selecting.acquire(blocking=False):
|
if not cls._selecting.acquire(blocking=False):
|
||||||
# there's already a thread running this code, abort.
|
# there's already a thread running this code, abort.
|
||||||
@ -162,7 +163,7 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
|||||||
if not cls._instances:
|
if not cls._instances:
|
||||||
return
|
return
|
||||||
rlist, wlist, xlist = select.select([x.conn for x in cls._instances],
|
rlist, wlist, xlist = select.select([x.conn for x in cls._instances],
|
||||||
[], [], conf.supybot.drivers.poll())
|
[], [], timeout)
|
||||||
for instance in cls._instances:
|
for instance in cls._instances:
|
||||||
if instance.conn in rlist:
|
if instance.conn in rlist:
|
||||||
instance._read()
|
instance._read()
|
||||||
|
Loading…
Reference in New Issue
Block a user