diff options
author | Anthony Wang | 2024-07-28 02:11:06 +0000 |
---|---|---|
committer | Anthony Wang | 2024-07-28 02:11:06 +0000 |
commit | 945c2da5d02df0d1014e47cdef09d6f308078e62 (patch) | |
tree | 4417f957dba83003f52abe7c2248aedb04f11ac8 | |
parent | 59641e75d47e4186a2fec0e5d2c16116d2471090 (diff) |
Ignore FileOpenedEvent
-rw-r--r-- | server.py | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -10,7 +10,7 @@ from xmlrpc.server import SimpleXMLRPCDispatcher, SimpleXMLRPCRequestHandler import pillow_avif import sqlite_vec from watchdog.observers import Observer -from watchdog.events import FileSystemEventHandler +from watchdog.events import FileSystemEventHandler, FileOpenedEvent import model @@ -39,9 +39,10 @@ def get_parent(path): class EventHandler(FileSystemEventHandler): def dispatch(self, event): - with lock: - print(event) - super().dispatch(event) + if not isinstance(event, FileOpenedEvent): + with lock: + print(event) + super().dispatch(event) def on_created(self, event): index(event.src_path, get_parent(event.src_path)) |