Jellyfin: who is watching, and don't update a machine mid-film
New Jellyfin integration (read-only, every 2 minutes): version, restart wanted, streams and transcoding, failed scheduled tasks, item counts, failed sign-ins. Monitoring -> Jellyfin page with a peak-streams history, three alerts, /metrics. When Jellyfin runs on a managed server, an update run asks first if people are streaming (409 "watching" unless startAnyway), and a patch plan waits up to two hours for them before updating that server. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2f082ca5c2
commit
0146eb8bca
38 files changed
+8136
-13
No files matched your search
@@ -15,6 +15,7 @@ import { createSemaphoreAdapter, type SemaphoreAdapter, type SemaphoreTask } fro
|
||||
import { invalidateAlertsCache } from "./alerts.js";
|
||||
import { recordAudit } from "./audit.js";
|
||||
import { startOrExtendWindow } from "./maintenance.js";
|
||||
import { watchingOnServer, watchingWords } from "./jellyfinSync.js";
|
||||
import { notifyUpdateRunFinished } from "./notify.js";
|
||||
import { parsePendingUpdates } from "./pendingUpdates.js";
|
||||
|
||||
@@ -68,6 +69,8 @@ export interface StartInput {
|
||||
/** How long the maintenance window lasts at most; it ends sooner when the run does. */
|
||||
windowMinutes: number;
|
||||
actor: string;
|
||||
/** Go ahead although somebody is streaming from the machine (a person who has seen the warning, or a plan that has waited long enough). */
|
||||
startAnyway?: boolean;
|
||||
}
|
||||
|
||||
export async function startUpdateRun(input: StartInput, now: Date = new Date()): Promise<UpdateRunRow> {
|
||||
@@ -82,6 +85,12 @@ export async function startUpdateRun(input: StartInput, now: Date = new Date()):
|
||||
.limit(1);
|
||||
if (busy) throw new UpdateRunError(409, "already_running", `An update run for ${server.name} is already under way.`);
|
||||
|
||||
// Jellyfin on this machine, with people watching: the run may restart it. Said, and the person asked again, rather than cutting a film off.
|
||||
if (!input.startAnyway) {
|
||||
const watching = await watchingOnServer(server.id, now);
|
||||
if (watching.length > 0) throw new UpdateRunError(409, "watching", `${watchingWords(watching)}. Wait until they have finished, or start it anyway.`);
|
||||
}
|
||||
|
||||
const adapter = await semaphoreFor(input.integrationId);
|
||||
if (!adapter) throw new UpdateRunError(400, "no_semaphore", "That Semaphore integration doesn't exist or isn't switched on.");
|
||||
|
||||
|
||||
Reference in new issue
Block a user