fix: telemetry single persistent connection + lock (kill concurrent write lock)

This commit is contained in:
2026-07-16 08:47:23 -04:00
parent 766592d855
commit 065c8ae1b9
3 changed files with 85 additions and 27 deletions
+2
View File
@@ -69,6 +69,8 @@ class HarnessLog:
self._run_id = run_id
self._register_run = register_run
Path(db_path).parent.mkdir(parents=True, exist_ok=True)
# 单持久连接 + 进程内 Lock 串行化写:把并发控制拉到进程内,消除多连接争
# SQLite 写锁。同款模式复用于 adapters/telemetry.py:SQLiteTelemetryRecorder。
self._conn = sqlite3.connect(db_path, check_same_thread=False)
self._lock = threading.Lock()
self._conn.row_factory = sqlite3.Row