perf(collector/watcher): 로컬 데이터 전송 성능 최적화 — mtime 프리체크, 프로젝트 캐시, re-forward 수정, 폴링 간격 조정

This commit is contained in:
Variet Worker
2026-03-13 23:13:18 +09:00
parent 1835166c5a
commit d4a2016d06
2 changed files with 89 additions and 5 deletions

View File

@@ -77,6 +77,27 @@ class BrainEventHandler(FileSystemEventHandler):
f"pre-loaded {hash_count} content hashes"
)
def dispatch(self, event: FileSystemEvent):
"""Early filter: skip events for files/dirs we don't care about.
This runs BEFORE on_created/on_modified, avoiding unnecessary
method dispatch overhead for the majority of file events.
"""
path = Path(event.src_path)
# Skip .system_generated and logs subdirectories immediately
path_parts = path.parts
if '.system_generated' in path_parts or 'logs' in path_parts:
return
# For file events, skip non-watched files immediately
if not event.is_directory:
file_name = path.name
if not self._is_watched_file(file_name):
return
super().dispatch(event)
def _is_conversation_id(self, name: str) -> bool:
parts = name.split("-")
return len(parts) == 5 and all(len(p) >= 4 for p in parts)