Undo _set_exception_handler

This commit is contained in:
taizan-hokuto
2020-01-18 09:18:20 +09:00
parent 970d111e1b
commit 1c5852421b

View File

@@ -109,7 +109,9 @@ class LiveChatAsync:
self._topchat_only = topchat_only self._topchat_only = topchat_only
if not LiveChatAsync._setup_finished: if not LiveChatAsync._setup_finished:
LiveChatAsync._setup_finished = True LiveChatAsync._setup_finished = True
if exception_handler: if exception_handler == None:
self._set_exception_handler(self._handle_exception)
else:
self._set_exception_handler(exception_handler) self._set_exception_handler(exception_handler)
if interruptable: if interruptable:
signal.signal(signal.SIGINT, signal.signal(signal.SIGINT,
@@ -319,6 +321,11 @@ class LiveChatAsync:
self._buffer.put_nowait({'chatdata':'','timeout':0}) self._buffer.put_nowait({'chatdata':'','timeout':0})
logger.info(f'[{self.video_id}]finished.') logger.info(f'[{self.video_id}]finished.')
@classmethod
def _set_exception_handler(cls, handler):
loop = asyncio.get_event_loop()
loop.set_exception_handler(handler)
@classmethod @classmethod
async def shutdown(cls, event, sig = None, handler=None): async def shutdown(cls, event, sig = None, handler=None):
logger.debug("shutdown...") logger.debug("shutdown...")