diff --git a/sample.py b/sample.py index 9873a69..69530a8 100644 --- a/sample.py +++ b/sample.py @@ -41,8 +41,14 @@ def handle_sighup(signum, frame): global room_status_log for room_id in log_files: - log_files[room_id].close() - room_status_log.close() + try: + log_files[room_id].close() + except Exception as e: + logger.exception(f"close log_files[{room_id}] failed with {e}") + try: + room_status_log.close() + except Exception as e: + logger.exception(f"close room_status_log failed with {e}") log_files = {} room_status_log = open("logs/room_status.jsonl", "a", encoding="utf-8")