SurfSense/surfsense_backend/app
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
..
agents refactor(podcasts): regenerate via brief gate, render brief inline in chat 2026-06-11 11:45:17 +02:00
automations refactor(agents): consolidate chat runtime infra under chat/runtime 2026-06-05 13:19:24 +02:00
config fix(db): prevent boot-time index DDL from hanging FastAPI startup 2026-06-16 16:18:49 -07:00
connectors chore: linting 2026-06-09 00:42:26 -07:00
etl_pipeline feat: enhance task management and timeout configurations in multi-agent chat 2026-05-27 14:58:10 -07:00
event_bus refactor(event_bus): wire catalog and events into package, rename builtin to events 2026-05-29 22:15:18 +02:00
file_storage chore: linting 2026-06-09 00:42:26 -07:00
gateway chore: linting 2026-06-09 00:42:26 -07:00
indexing_pipeline fix(indexing): log and recover session in rollback_and_persist_failure 2026-06-10 00:10:25 +02:00
notifications feat(refactor): refactor payment system to implement unified credit wallet. 2026-06-10 16:49:03 -07:00
observability feat(gateway): add worker and webhook metrics 2026-05-28 04:44:28 +05:30
podcasts style(podcasts): fix ruff issues in podcast spec schema 2026-06-16 23:57:36 +02:00
prompts refactor(agents): relocate boundary-only infra out of shared/ 2026-06-05 12:36:44 +02:00
retriever feat(retriever): instrument knowledge base search 2026-05-21 23:03:31 +05:30
routes fix(podcasts): guard public stream against missing audio 2026-06-16 20:09:08 +02:00
schemas Merge remote-tracking branch 'upstream/dev' into improvement-podcast-graph 2026-06-11 23:14:49 +02:00
services Merge remote-tracking branch 'upstream/dev' into improvement-podcast-graph 2026-06-11 23:14:49 +02:00
tasks fix(auto_reload): update task to use a lambda for user_id in async call 2026-06-11 16:51:18 -07:00
templates feat: update report generation and export capabilities to support multiple formats (PDF, DOCX, HTML, LaTeX, EPUB, ODT, plain text) across documentation and backend 2026-03-09 18:41:21 -07:00
utils chore: linting 2026-06-09 00:42:26 -07:00
__init__.py feat: SurfSense v0.0.6 init 2025-03-14 18:53:14 -07:00
app.py feat: made chat fast 2026-06-09 04:45:17 -07:00
celery_app.py Merge remote-tracking branch 'upstream/dev' into improvement-podcast-graph 2026-06-11 23:14:49 +02:00
db.py fix(db): prevent boot-time index DDL from hanging FastAPI startup 2026-06-16 16:18:49 -07:00
exceptions.py feat: add processing mode support for document uploads and ETL pipeline, improded error handling ux 2026-04-14 21:26:00 -07:00
rate_limiter.py try: ip fix for cludflare 2026-04-16 02:13:52 -07:00
session_events.py refactor: anonymous/free chat experience 2026-05-31 15:58:21 -07:00
users.py Seed default prompts on registration and for existing users 2026-03-31 18:12:09 +02:00
zero_publication.py feat(migration): evolve podcast lifecycle by detaching from zero_publication and updating column handling 2026-06-11 16:17:14 -07:00