mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-22 18:52:45 +01:00
We now spawn a thread for invalidCommands when any of the plugins that will run invalidCommands are threaded.
This commit is contained in:
parent
e1d3c5e537
commit
c621905d91
@ -652,13 +652,25 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
|
|||||||
|
|
||||||
def _callInvalidCommands(self):
|
def _callInvalidCommands(self):
|
||||||
log.debug('Calling invalidCommands.')
|
log.debug('Calling invalidCommands.')
|
||||||
|
threaded = False
|
||||||
|
cbs = []
|
||||||
for cb in self.irc.callbacks:
|
for cb in self.irc.callbacks:
|
||||||
if hasattr(cb, 'invalidCommand'):
|
if hasattr(cb, 'invalidCommand'):
|
||||||
log.debug('Trying to call %s.invalidCommand.' % cb.name())
|
cbs.append(cb)
|
||||||
|
threaded = threaded or cb.threaded
|
||||||
|
def callInvalidCommands():
|
||||||
|
for cb in cbs:
|
||||||
self._callInvalidCommand(cb)
|
self._callInvalidCommand(cb)
|
||||||
if self.msg.repliedTo:
|
if self.msg.repliedTo:
|
||||||
log.debug('Done calling invalidCommands: %s.',cb.name())
|
log.debug('Done calling invalidCommands: %s.',cb.name())
|
||||||
return
|
return
|
||||||
|
if threaded:
|
||||||
|
name = 'Thread #%s (for invalidCommands)' % world.threadsSpawned
|
||||||
|
t = world.SupyThread(callInvalidCommands, name=name)
|
||||||
|
t.setDaemon(True)
|
||||||
|
t.start()
|
||||||
|
else:
|
||||||
|
callInvalidCommands()
|
||||||
|
|
||||||
def _callInvalidCommand(self, cb):
|
def _callInvalidCommand(self, cb):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user