SurfSense/surfsense_backend/app/config
DESKTOP-RTLN3BA\$punk 89cc3b37ee fix(db): prevent boot-time index DDL from hanging FastAPI startup
A single abandoned "idle in transaction" session held locks on the
documents table, which blocked the non-concurrent CREATE INDEX (hnsw)
run inside the FastAPI lifespan. Each API restart queued another
CREATE INDEX behind an advisory lock, leaving the server stuck at
"Waiting for application startup." indefinitely and freezing ingestion
writes.

Changes:
- setup_indexes(): build every index with CREATE INDEX CONCURRENTLY
  (non-blocking ShareUpdateExclusiveLock) under a per-session
  lock_timeout, and make each statement non-fatal so a contended/slow
  build is retried next boot instead of wedging startup. Drop leftover
  invalid indexes before rebuilding.
- create_db_and_tables(): apply lock_timeout to extension/create_all
  DDL and gate the whole bootstrap behind DB_BOOTSTRAP_ON_STARTUP.
- engine: set idle_in_transaction_session_timeout (asyncpg) so an
  abandoned transaction is reaped automatically.
- config + .env.example: DB_BOOTSTRAP_ON_STARTUP, DB_DDL_LOCK_TIMEOUT_MS,
  DB_IDLE_IN_TX_TIMEOUT_MS.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 16:18:49 -07:00
..
__init__.py fix(db): prevent boot-time index DDL from hanging FastAPI startup 2026-06-16 16:18:49 -07:00
global_llm_config.example.yaml feat: upgrade MiniMax default model to M3 2026-06-02 01:48:11 +08:00
model_list_fallback.json feat: added improved llm model selector 2026-02-20 14:28:01 -08:00
uvicorn.py Fixed all ruff lint and formatting errors 2025-07-24 14:43:48 -07:00
vision_model_list_fallback.json Add dynamic vision model list from OpenRouter with combobox selector 2026-04-07 23:39:52 +02:00