3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-28 05:29:25 +01:00

protocols/: thread calls to each event hook to prevent blocking globally

Closes #59.
This commit is contained in:
James Lu 2015-07-17 14:35:02 -07:00
parent 9bef93c341
commit 99fd6060a7

View File

@ -3,6 +3,7 @@ import sys
import os import os
import traceback import traceback
import re import re
import threading
from copy import copy from copy import copy
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@ -588,7 +589,7 @@ def handle_events(irc, data):
for hook_func in utils.command_hooks[hook_cmd]: for hook_func in utils.command_hooks[hook_cmd]:
try: try:
log.debug('Calling function %s', hook_func) log.debug('Calling function %s', hook_func)
hook_func(irc, numeric, command, parsed_args) threading.Thread(target=hook_func, args=(irc, numeric, command, parsed_args)).start()
except Exception: except Exception:
# We don't want plugins to crash our servers... # We don't want plugins to crash our servers...
traceback.print_exc() traceback.print_exc()