From d13a5069e3a0e78a77bf16effe78f2ba223c495b Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 27 Nov 2018 14:25:12 +0000 Subject: Grab response from functions asked to be executed on the main thread and feed them back to the callers, allowing rest_api.py to take the main thread while it's waiting for the response to give back to the requesting client --- modules/signals.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules/signals.py') diff --git a/modules/signals.py b/modules/signals.py index 9bf2c9a8..9d8230ed 100644 --- a/modules/signals.py +++ b/modules/signals.py @@ -11,7 +11,10 @@ class Module(ModuleManager.BaseModule): def SIGINT(self, signum, frame): print() - self.events.on("signal.interrupt").call(signum=signum, frame=frame) + self.bot.trigger(lambda: self._kill(signum)) + + def _kill(self, signum): + self.events.on("signal.interrupt").call(signum=signum) for server in self.bot.servers.values(): reason = "Leaving" @@ -19,7 +22,6 @@ class Module(ModuleManager.BaseModule): reason = self.events.on("get.quit-quote" ).call_for_result(default=reason) server.send_quit(reason) - self.bot.trigger() self.events.on("writebuffer.empty").hook( lambda event: self.bot.disconnect(event["server"])) -- cgit v1.3.1-10-gc9f91