From df33771b1010e1e188405063fb16b24ada106bea Mon Sep 17 00:00:00 2001 From: taizan-hokuto <55448286+taizan-hokuto@users.noreply.github.com> Date: Mon, 11 Nov 2019 22:56:54 +0900 Subject: [PATCH] Fix initializing of handler exception --- pytchat/core_async/replaychat.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pytchat/core_async/replaychat.py b/pytchat/core_async/replaychat.py index 07c02fd..e28abb7 100644 --- a/pytchat/core_async/replaychat.py +++ b/pytchat/core_async/replaychat.py @@ -92,8 +92,9 @@ class ReplayChatAsync: else: self._set_exception_handler(exception_handler) if interruptable: - signal.signal(signal.SIGINT, (lambda a, b: - (ReplayChatAsync.shutdown(None,signal.SIGINT,b)) + signal.signal(signal.SIGINT, + (lambda a, b:asyncio.create_task( + ReplayChatAsync.shutdown(None,signal.SIGINT,b)) )) def _setup(self): @@ -276,7 +277,7 @@ class ReplayChatAsync: self._is_alive = False if self._direct_mode == False: #bufferにダミーオブジェクトを入れてis_alive()を判定させる - self._buffer.put({'chatdata':'','timeout':1}) + self._buffer.put_nowait({'chatdata':'','timeout':1}) logger.info(f'終了しました:[{self.video_id}]') @classmethod