File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 2121# Retry policy for DB-locked operations
2222DB_LOCK_RETRY_COUNT = 6
2323DB_LOCK_RETRY_BASE_DELAY = 0.05 # seconds, exponential backoff multiplier
24+ _sqlite_vector_loaded = False
2425
2526
2627def connect_db(db_path: str, timeout: float = 30.0) -> sqlite3.Connection:
@@ -58,9 +59,16 @@ def load_sqlite_vector_extension(conn: sqlite3.Connection) -> None:
5859 Raises:
5960 RuntimeError: If the extension fails to load
6061 """
62+ global _sqlite_vector_loaded
63+
64+ if _sqlite_vector_loaded:
65+ logger.debug("sqlite-vector: already loaded in-process, skipping load.")
66+ return
67+
6168 try:
6269 ext_path = importlib.resources.files(SQLITE_VECTOR_PKG) / SQLITE_VECTOR_RESOURCE
6370 conn.load_extension(str(ext_path))
71+ _sqlite_vector_loaded = True
6472 try:
6573 conn.enable_load_extension(False)
6674 except Exception:
You can’t perform that action at this time.
0 commit comments