From 99fd6060a7865f79694c52f4235f6ed05af29829 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 17 Jul 2015 14:35:02 -0700 Subject: [PATCH] protocols/: thread calls to each event hook to prevent blocking globally Closes #59. --- protocols/inspircd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 64bdd74..1b38ef0 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -3,6 +3,7 @@ import sys import os import traceback import re +import threading from copy import copy 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]: try: 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: # We don't want plugins to crash our servers... traceback.print_exc()