You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: prevent concurrent Discogs and MusicBrainz extraction (#271)
* feat(extractor): add discogs_health_url to ExtractorConfig
Add `discogs_health_url` field to `ExtractorConfig` with default value
`http://extractor-discogs:8000/health`, readable via `DISCOGS_HEALTH_URL`
env var. Used by the MusicBrainz extractor to poll the Discogs extractor's
health endpoint before starting extraction (mutual exclusion).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat(extractor): add wait_for_discogs_idle() health polling functions
Add functions that poll the Discogs extractor's health endpoint and
block while extraction_status is "running", enabling mutual exclusion
between Discogs and MusicBrainz extraction. Falls back after 10
unreachable attempts. Includes 6 tests covering idle/completed/failed
status, running-then-idle transition, max retries, and shutdown signal.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat(extractor): integrate wait_for_discogs_idle into MusicBrainz loop
Call wait_for_discogs_idle() before each process_musicbrainz_data()
invocation in run_musicbrainz_loop() to ensure Discogs and MusicBrainz
extractions never run concurrently. Initial extraction propagates errors;
periodic and triggered extractions log and continue on health check
failure. Add DISCOGS_HEALTH_URL env var to extractor-musicbrainz in
docker-compose.yml.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* style(extractor): apply rustfmt to changed files
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(extractor): increase trigger test shutdown delay for CI reliability
The trigger tests spawn a background task that sends shutdown after a delay.
With the added wait_for_discogs_idle() HTTP call, the trigger arm takes longer
to complete. In CI's slower environment, the 2000ms delay caused the shutdown
to fire during the trigger arm (not during the select!), leading to a race
condition in tokio's single-threaded test runtime. Increased to 5000ms.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(extractor): increase trigger test initial delay for CI reliability
The background task that removes the state marker and sets the trigger
was only waiting 50ms. With the new wait_for_discogs_idle() HTTP call
before initial processing, 50ms is not enough in CI — the marker gets
deleted before initial processing reads it, causing unexpected failures.
Increased to 2000ms to ensure initial processing (including health check)
completes before the marker is removed and the trigger fires.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments