docs: the superseded fallback answers its own session; who uses beacon()

This commit is contained in:
2026-10-08 01:16:30 +02:00
parent 5095047c81
commit a504550196
2 changed files with 9 additions and 7 deletions
+3 -2
View File
@@ -744,8 +744,9 @@ def start_session(
# `replace_only` makes the supersede identity-aware for the runtime fallback: the whole
# check-and-replace happens under ONE _lock, so a newer same-key session (a concurrent
# seek-restart) installed between the fallback's decision and here is never clobbered. When the
# registered session is no longer `replace_only`, we abort and return None (the caller yields to
# whoever is registered now). The INITIAL spawn never gets None — see its call site.
# registered session is no longer `replace_only`, we abort and return None, and the caller
# answers with its own dead session — never the newer one, whose id a stale requester would
# stop. The INITIAL spawn never gets None — see its call site.
# Software-fallback encode tuning — read only on the SW transcode path (the VAAPI path and
# remux ignore preset/crf/max_height, and remux must not touch the DB for them).
preset, crf, max_height = "veryfast", 20, 0
+6 -5
View File
@@ -285,11 +285,12 @@ export function identityHeaders(): Record<string, string> {
};
}
// Fire-and-forget POST that survives page unload (keepalive) — shared by the resume-position
// beacons (YT + Plex players). A normal fetch is cancelled on unload and React effect cleanup
// doesn't run on a full reload, so without keepalive the last position (esp. right after a seek)
// would be lost. `onSettled`: the request has been answered (or failed) — for a caller whose cached
// view must be read again once the write is on the server.
// Fire-and-forget POST that survives page unload (keepalive) — for every write a closing page must
// still make: the resume checkpoints of the YouTube, Plex and library players, the Plex session stop,
// the diagnostics flush. A normal fetch is cancelled on unload and React effect cleanup doesn't run
// on a full reload, so without keepalive the last position (esp. right after a seek) would be lost.
// `onSettled`: the request has been answered (or failed) — for a caller whose cached view must be
// read again once the write is on the server.
export function beacon(url: string, body: Record<string, unknown>, onSettled?: () => void): void {
try {
void send(url, {