diff options
-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)) |