mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 20:52:42 +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 time
|
||||||
import types
|
import types
|
||||||
|
import threading
|
||||||
|
|
||||||
import conf
|
import conf
|
||||||
|
import debug
|
||||||
import ircdb
|
import ircdb
|
||||||
|
import world
|
||||||
import ircutils
|
import ircutils
|
||||||
import callbacks
|
import callbacks
|
||||||
import structures
|
import structures
|
||||||
@ -168,7 +171,14 @@ def urlSnarfer(f):
|
|||||||
debug.msg('Refusing to snarf %s.')
|
debug.msg('Refusing to snarf %s.')
|
||||||
else:
|
else:
|
||||||
q.enqueue((url, msg.args[0], now))
|
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,
|
newf = types.FunctionType(newf.func_code, newf.func_globals,
|
||||||
f.func_name, closure=newf.func_closure)
|
f.func_name, closure=newf.func_closure)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
|
Loading…
Reference in New Issue
Block a user