The listener does not bind until the first scan finishes #18
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
serve()awaitsscan_librariesatcrates/jellyfin-server/src/main.rs:80;the bind is at
:175. Until the first scan completes there is no server at all— not a 503, no port.
For this library that is 12 m 22 s of nothing. Upstream serves immediately and
scans behind the API.
The
LibraryScannerport andtasks::Tasksalready exist (main.rs:198-217),so it is mostly moving the call behind the bind. The startup scan and a
task-triggered
/Library/Refreshmust then not overlap — atokio::sync::Semaphore(1)inLibraries, where failing to acquire is also thehonest answer for the task status.
Found by scanning
/mnt/media(285 movies, 289 shows, 74 music artists —~13 000 media files on a CIFS mount) with both this server and upstream
Jellyfin at the pinned commit, remote metadata and image fetchers disabled on
upstream so both were reading files only. Upstream was given the same mount
path so
MD5(UTF-16LE(path))agrees and rows compare directly.Fixed in
a94abf3and3c96d5e.Measured on the same library, from a fresh database: the port answers after
0.51 s rather than after the scan. The scan then ran behind it for 30 m and
finished with the task reporting
Completedand/Items/Countsfull.It runs as the scheduled task rather than beside one, so
/ScheduledTaskssays
Runningwhile it does and a/Library/Refreshasked for meanwhile isthe one the task refuses — verified against the running server, and now under
test.
Upstream's ordering is the same:
Program.csstarts the host beforeRunStartupTasksAsync. Two differences worth recording, neither fixed here:Retry-Afterfrom a setup server on the portfrom the very first moment, where this server has no port for half a second
and then answers normally with whatever the database holds. On a first run
that is an empty library rather than a 503.
hour in. This server scans at startup because it has no setup wizard to
create libraries.
The ffmpeg capability probe still runs before the bind: 1.7 s of
ffmpeg -hspawns on this machine, and a misconfigured
encoding.ffmpegstill stopsstartup rather than binding and failing per request as upstream does.
Review raised one thing worth writing down: a scan aborted part way leaves
items filed with no streams, and a later pass skips them because the file has
not moved. That is #28 — nothing backfills what a previous pass did not
write — and the overlap this commit introduces makes it easier to reach.