mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Made urlSnarfer thread the snarfer if the callback isn't already threaded.
This commit is contained in:
parent
889ed86026
commit
23fa15f303
@ -37,9 +37,12 @@ import fix
|
||||
|
||||
import time
|
||||
import types
|
||||
import threading
|
||||
|
||||
import conf
|
||||
import debug
|
||||
import ircdb
|
||||
import world
|
||||
import ircutils
|
||||
import callbacks
|
||||
import structures
|
||||
@ -168,7 +171,14 @@ def urlSnarfer(f):
|
||||
debug.msg('Refusing to snarf %s.')
|
||||
else:
|
||||
q.enqueue((url, msg.args[0], now))
|
||||
f(self, irc, msg, match, *L)
|
||||
if self.threaded:
|
||||
f(self, irc, msg, match, *L)
|
||||
else:
|
||||
L = list(L)
|
||||
t = threading.Thread(target=f, args=[self, irc, msg, match]+L)
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
world.threadsSpawned += 1
|
||||
newf = types.FunctionType(newf.func_code, newf.func_globals,
|
||||
f.func_name, closure=newf.func_closure)
|
||||
newf.__doc__ = f.__doc__
|
||||
|
Loading…
Reference in New Issue
Block a user