Simon Gardling ddac5e3f04 jellyfin-annotations: preserve state on grafana failure, add grace period
Three edge cases broke annotations on reboot or interrupted sessions:

- state.pop() ran before grafana_close(), so a failed PATCH (Grafana
  still restarting after reboot) permanently lost the grafana_id and
  left the annotation open forever in Grafana.
- a single poll with no sessions closed every active annotation, so
  Jellyfin restarts or client reconnects produced spurious close +
  duplicate-open pairs.
- timeEnd was always now_ms, so a reboot during playback wrote an
  annotation reading as if the user watched through the outage.

Fix: track last_seen_ms and missing_count in state; retain entries
until grafana_close succeeds (retry indefinitely); require
MISSING_THRESHOLD absent polls before close; clamp close_time to
last_seen_ms + (MISSING_THRESHOLD + 1) * POLL_INTERVAL.

Adds three subtests in tests/jellyfin-annotations.nix that each fail
on the old code and pass on the new.
2026-04-22 00:35:26 -04:00
2026-04-18 02:03:05 -04:00
2026-04-20 17:26:53 -04:00
2026-04-18 01:56:35 -04:00

My NixOS configs

Hosts

  • mreow: My personal Framework 13 laptop
  • yarn: Machine I usually just play games on. Boots into SteamOS-like interface.
  • muffin: Homeserver, runs various services.

Desktop/Laptop

What do I use?

Browser: Firefox 🦊 (actually Zen Browser :p)

Text Editor: Doom Emacs

Terminal: alacritty

Shell: fish with the pure prompt

WM: niri (KDE on my desktop)

Background

  • Got my background from here and used the command magick input.png -filter Point -resize 2880x1920! output.png to upscale it bilinearly
Description
Unified NixOS flake for mreow, yarn, muffin
Readme 3.7 MiB
Languages
Nix 84.6%
Python 10.7%
Emacs Lisp 2.6%
Shell 2.1%