CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m39s
CI / test (push) Successful in 3m38s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / trigger-deploy (push) Skipped
CI / notify (push) Successful in 5s
Root cause: gunicorn runs only 2 sync workers, and GET /api/v1/art/album did its MusicBrainz + Cover Art Archive work synchronously inside the request (2-12+ seconds per call, measured). A page with several uncached albums could tie up the entire application - every endpoint, every user - for as long as that took. Separately, even an already-resolved album re-streamed its image bytes live from Cover Art Archive on every single page view, by the original v1 design. The endpoint is now cache-only: it reads the album_art table and, if resolved, a local file, and never touches the network. A cache miss records a "pending" row and returns 404 immediately - the frontend already treats 404 as "show the placeholder," so no frontend changes are needed. A new background worker task (the same claim-with- FOR-UPDATE-SKIP-LOCKED pattern already used by imports and federation deliveries) does the actual resolving and downloads the image bytes to a shared volume, completely decoupled from any request. No migration needed: AlbumArt.status just gains a new "pending" value. Verified against the real docker compose stack (not just the test suite): cold lookups for 5 real albums all returned 404 in well under 0.2s (previously 2-12+s each), the worker resolved all 5 within ~10s in the background, and resolved art then served in single-digit milliseconds from the volume, including after a full container restart (no re-download). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011Hn2QwS1HRT8tFAzo8ew63
40 lines
1.5 KiB
Bash
40 lines
1.5 KiB
Bash
# Copy to .env for local development.
|
|
# Host port docker compose publishes Postgres on.
|
|
DB_PORT=5432
|
|
DATABASE_URL=postgresql+psycopg://scrobbler:scrobbler@localhost:5432/scrobbler
|
|
TEST_DATABASE_URL=postgresql+psycopg://scrobbler:scrobbler@localhost:5432/scrobbler_test
|
|
SECRET_KEY=change-me
|
|
|
|
# Origin(s) of the static UI allowed to call /api/v1 (comma separated).
|
|
CORS_ORIGINS=http://localhost:8080
|
|
# Where Last.fm clients are redirected to approve desktop auth tokens.
|
|
UI_BASE_URL=http://localhost:8080
|
|
|
|
# Prometheus metrics are served on a separate port.
|
|
METRICS_PORT=9100
|
|
|
|
# Set to allow importing history straight from Last.fm (https://www.last.fm/api/account/create).
|
|
LASTFM_API_KEY=
|
|
|
|
# Album art (MusicBrainz + Cover Art Archive, both free and keyless — no setup required).
|
|
# MusicBrainz asks for a contact URL/email in requests; falls back to UI_BASE_URL if unset.
|
|
MUSICBRAINZ_CONTACT=
|
|
# Where downloaded art is stored. docker compose points this at a shared volume; the
|
|
# default below is for running the api/worker directly (not in Docker).
|
|
ART_STORAGE_DIR=var/album-art
|
|
|
|
# docker compose host ports (defaults shown)
|
|
API_PORT=5050
|
|
UI_PORT=8080
|
|
PROMETHEUS_PORT=9090
|
|
GRAFANA_PORT=3000
|
|
GRAFANA_ADMIN_PASSWORD=admin
|
|
|
|
# ActivityPub federation (in development; off by default). See src/scrobbler/federation/README.md.
|
|
# Use the web UI's host and origin: handles become @user@<FEDERATION_DOMAIN>.
|
|
FEDERATION_ENABLED=0
|
|
FEDERATION_DOMAIN=
|
|
FEDERATION_BASE_URL=
|
|
# 32+ characters; encrypts actors' private keys. Keep it safe and never change it.
|
|
FEDERATION_KEY_SECRET=
|