feat(agent): el auto-update difiere hasta que no haya stream activo
Un auto-update reiniciaba el daemon al momento y cortaba la
reproducción en curso (mata la sesión HLS viva → freeze → F5). Ahora
el path AUTO (OnUpgrade) difiere indefinido mientras haya streams
activos y aplica solo en idle. Ningún update en segundo plano vale
cortar un visionado.
- HLSSessionRegistry.Count() + playerSessionRegistry.count() →
GetActiveStreamCount() = player (HLS/direct/remux) + transcode HLS.
- deferAutoUpgradeUntilIdle: guard de un solo waiter, ticker 30s,
aplica al llegar a 0 streams.
- `unarr update` (manual) SIN cambios: aplica al momento = escape
hatch para un fix urgente.
- SyncRequest.agentStatus ("updating") reportado antes del restart
para que la web pueda avisar en vez de dar error de sesión.
This commit is contained in:
parent
91ee5e4b6f
commit
59da949a53
6 changed files with 84 additions and 1 deletions
|
|
@ -579,6 +579,12 @@ func runDaemonStart() error {
|
|||
sc.GetFreeSlots = manager.FreeSlots
|
||||
sc.GetTaskStates = manager.TaskStates
|
||||
d.GetActiveCount = manager.ActiveCount
|
||||
// Live stream count for the graceful auto-upgrade gate: player sessions
|
||||
// (in-browser HLS / direct-play / remux) + HLS transcode sessions. An auto
|
||||
// upgrade defers while this is > 0 so it never cuts a viewer mid-playback.
|
||||
d.GetActiveStreamCount = func() int {
|
||||
return playerSessionRegistry.count() + streamSrv.HLS().Count()
|
||||
}
|
||||
|
||||
// Trigger immediate sync when a download slot frees up
|
||||
manager.OnTaskDone = func() { d.TriggerSync() }
|
||||
|
|
|
|||
|
|
@ -41,6 +41,12 @@ func (r *playerSessionRegistryT) remove(sessionID string) {
|
|||
delete(r.cancels, sessionID)
|
||||
}
|
||||
|
||||
func (r *playerSessionRegistryT) count() int {
|
||||
r.mu.Lock()
|
||||
defer r.mu.Unlock()
|
||||
return len(r.cancels)
|
||||
}
|
||||
|
||||
// cancelAllPlayerSessions cancels every running session. Called on daemon
|
||||
// shutdown so the ffmpeg children and SSE consumers exit cleanly.
|
||||
func cancelAllPlayerSessions() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue