Fix: media index build never starts (blocking Jellyfin dependency)
The build endpoint had Depends(get_jellyfin_client) and Depends(get_user_id) which executed BEFORE the function body. If Jellyfin was unreachable, these raised HTTPException(503), the function never ran, and the worker was never started. The frontend mutation had no onError handler, so the failure was completely silent — the button briefly showed 'Building...' then reverted to 'Build index' with zero feedback. Backend fix: removed the Jellyfin dependencies from post_build_index. The worker subprocess resolves its own Jellyfin connection via _resolve_jellyfin(service_id) — the endpoint just needs to start the worker process. The libraries count starts at 0 and gets updated by the worker once it connects. Frontend fix: added onError to useBuildIndex that invalidates the status query (so the UI reflects the non-building state). MediaTab now displays the build error inline: 'Build failed: <message>' next to the button. 283 backend tests pass (updated build test for new no-dependency flow); 128 frontend tests pass; ruff/eslint clean.
This commit is contained in:
@@ -363,7 +363,7 @@ class TestMediaIndexApi:
|
||||
assert data["status"] == "started"
|
||||
assert data["build_running"] is True
|
||||
assert data["build_stage"] == "queued"
|
||||
assert data["build_libraries_total"] == len(mock_jellyfin.libraries.return_value)
|
||||
assert data["build_libraries_total"] == 0
|
||||
assert data["build_pid"] == 4321
|
||||
start_worker.assert_called_once()
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user