diff --git a/lyrebird/application.py b/lyrebird/application.py index 7b32f045..d0ed446f 100644 --- a/lyrebird/application.py +++ b/lyrebird/application.py @@ -138,7 +138,6 @@ def destory(self): for lock in self.async_objs['locks']: del lock self.manager.shutdown() - self.manager.join() self.manager = None self.async_objs = None diff --git a/lyrebird/manager.py b/lyrebird/manager.py index 3dcd2ebe..727550b0 100644 --- a/lyrebird/manager.py +++ b/lyrebird/manager.py @@ -95,6 +95,21 @@ def main(): print(version.LYREBIRD) return + # stop event handler + def signal_handler(signum, frame): + application.stop_server() + application.terminate_server() + if application.sync_manager: + application.sync_manager.destory() + if application.config and application.config.get('enable_multiprocess', False): + RedisManager.destory() + threading.Event().set() + print('!!!Ctrl-C pressed. Lyrebird stop!!!') + os._exit(0) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + Path('~/.lyrebird').expanduser().mkdir(parents=True, exist_ok=True) custom_conf = {es[0]: es[1] for es in args.extra_string} if args.extra_string else {} @@ -265,20 +280,6 @@ def run(args: argparse.Namespace): # main process is ready, publish system event application.status_ready() - # stop event handler - def signal_handler(signum, frame): - application.stop_server() - application.terminate_server() - application.sync_manager.destory() - if application.config.get('enable_multiprocess', False): - RedisManager.destory() - threading.Event().set() - print('!!!Ctrl-C pressed. Lyrebird stop!!!') - os._exit(0) - - signal.signal(signal.SIGINT, signal_handler) - signal.signal(signal.SIGTERM, signal_handler) - threading.Event().wait() diff --git a/lyrebird/version.py b/lyrebird/version.py index db2d732e..f643fc7a 100644 --- a/lyrebird/version.py +++ b/lyrebird/version.py @@ -1,3 +1,3 @@ -IVERSION = (3, 0, 4) +IVERSION = (3, 0, 5) VERSION = ".".join(str(i) for i in IVERSION) LYREBIRD = "Lyrebird " + VERSION