We now spawn a thread for invalidCommands when any of the plugins that will run invalidCommands are threaded.

This commit is contained in:
Jeremy Fincher 2005-04-13 03:20:58 +00:00
parent e1d3c5e537
commit c621905d91

View File

@ -652,13 +652,25 @@ class NestedCommandsIrcProxy(ReplyIrcProxy):
def _callInvalidCommands(self):
log.debug('Calling invalidCommands.')
threaded = False
cbs = []
for cb in self.irc.callbacks:
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)
if self.msg.repliedTo:
log.debug('Done calling invalidCommands: %s.',cb.name())
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):
try: