This commit is contained in:
tursom 2024-10-11 18:09:08 +08:00
parent d20d64204a
commit 46ef3d4d0a

View File

@ -64,7 +64,10 @@ class MyHandler(FileSystemEventHandler):
room.position = os.path.getsize(event.src_path)
for line in f:
data = json.loads(line)
try:
data = json.loads(line)
except json.decoder.JSONDecodeError:
continue
self._handle_data(room, data)
self._check_room_state_change(room)
@ -81,7 +84,10 @@ class MyHandler(FileSystemEventHandler):
with open(event.src_path, "r", encoding="utf-8") as f:
for line in f:
data = json.loads(line)
try:
data = json.loads(line)
except json.decoder.JSONDecodeError:
continue
self._handle_data(data)
self._check_room_state_change(room)