siftlode/backend/app/routes
npeter83 6dece18ae8 fix(plex): image proxy no longer exhausts the DB connection pool
A collections page fires 100+ concurrent poster requests. Both image proxies
(/image and /person-image) authenticated via current_user + Depends(get_db),
holding a pooled DB connection for the whole request — including the slow Plex/
CDN fetch. Under the burst, the 15-connection pool was exhausted → QueuePool
checkout timeouts → 502s → slow, partially-loaded grids on prod.

Fix: authenticate these two high-fan-out endpoints with a signed-session check
(no DB user-load), serve disk-cache hits with zero DB access, and on a cold miss
open a short session only to resolve the image key + Plex config, releasing it
BEFORE the fetch (image_bytes uses no DB). Also raise the pool (20 + 30 overflow)
as headroom above the sync-endpoint threadpool.
2026-07-06 07:14:28 +02:00
..
__init__.py feat: M1 foundation — compose stack, FastAPI, Google OAuth, encrypted tokens 2026-06-11 01:01:37 +02:00
admin.py feat(search): ephemeral results, count selector, blocklist, new-first ordering (backend) 2026-07-01 00:42:32 +02:00
channels.py feat(search): ephemeral results UX, count selector, channel blocklist (frontend) 2026-07-01 01:00:32 +02:00
config.py feat(config): DB-backed system_config infrastructure + SMTP group 2026-06-19 12:22:36 +02:00
downloads.py feat(downloads): store + show a canonical "downloaded from" source URL 2026-07-04 21:25:37 +02:00
feed.py feat(search): ephemeral results, count selector, blocklist, new-first ordering (backend) 2026-07-01 00:42:32 +02:00
health.py feat: M1 foundation — compose stack, FastAPI, Google OAuth, encrypted tokens 2026-06-11 01:01:37 +02:00
me.py feat(plex): P1 frontend — Plex feed source, browse/search, show drill-down 2026-07-05 02:32:00 +02:00
messages.py feat(auth): per-tab account — different account per browser tab 2026-07-01 23:43:35 +02:00
notifications.py feat(notifications): durable per-user inbox (P1) + maintenance schema 2026-06-18 03:20:17 +02:00
playlists.py refactor(playlists,feed): share feed-row projection & playlist helpers 2026-06-26 03:15:53 +02:00
plex.py fix(plex): image proxy no longer exhausts the DB connection pool 2026-07-06 07:14:28 +02:00
public.py feat(downloads): public share-by-link + watch page backend 2026-07-04 04:19:29 +02:00
quota.py feat(stats): per-user API quota attribution + admin usage page 2026-06-12 02:47:55 +02:00
saved_views.py feat(views): saved-views backend — table, model, CRUD + reorder API 2026-07-01 03:17:36 +02:00
scheduler.py feat(config): move operational params to DB (quota/backfill/shorts/batch) 2026-06-19 13:07:45 +02:00
search.py feat(search): ephemeral results, count selector, blocklist, new-first ordering (backend) 2026-07-01 00:42:32 +02:00
setup.py feat(setup): install-wizard step endpoints (epic 6c, API) 2026-06-21 00:40:54 +02:00
sync.py refactor(backend): quota.measured helper, consistent admin gating, messageable predicate 2026-06-26 03:15:53 +02:00
tags.py refactor(auth): centralize token hashing, email validation & admin gating 2026-06-26 03:15:36 +02:00
version.py feat(version): /api/version + build-time version/commit stamping 2026-06-15 00:06:57 +02:00