oficina / slides Public

Slides: saving never stops while a link is loading, and a stop closes the streams

Docs' fix (Docs #94), on the same code. WebKit refuses every ordinary
fetch, XHR and Blob read while a link the page opened is loading, so
every save read as a failure: "retrying" four times a second, nothing
sent. Saves now go keepalive, at most 32KiB and gzipped from 1KB
(updatesPost gunzips under the same limits); the unload beacon leaves out
a keepalive save on the wire, which shares its 64KiB; the queue resends
on pageshow and gives up on an unanswered save; and a save refused with
no answer is "retrying" only if /healthz cannot be reached either.

On SIGTERM the editor's, the projector's and the share link's streams
never ended, because a graceful shutdown cancels no request: an open one
held it ten seconds and the process exited 1. Slides drains them on the
signal; a stream opened while stopping gets a clean end and a retry
delay, so a projector's EventSource reconnects to the next instance.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 970cf615c1bca687b78362177b6b7f1614da81dd parent 4c23861
17 files changed, +1,818 −65
  • AGENTS.md +22 −0
  • cmd/slides/main.go +14 −0
  • cmd/slides/shutdown_test.go +185 −0
  • fixtures/editor-entry.js +53 −23
  • fixtures/engines/saving-webkit.swift +155 −0
  • fixtures/engines/saving.mjs +91 −0
  • fixtures/save-queue.mjs +215 −11
  • fixtures/save-queue.test.mjs +250 −5
  • internal/slides/drain.go +65 −0
  • internal/slides/handlers.go +3 −0
  • internal/slides/live.go +66 −7
  • internal/slides/presentation.go +11 −3
  • internal/slides/static/editor.6401451793bdc579.js +16 −0
  • internal/slides/static/editor.edeb171c568b6ea8.js +0 −16
  • internal/slidestest/drain_test.go +171 −0
  • internal/slidestest/harness_test.go +1 −0
  • internal/slidestest/saving_browser_test.go +500 −0
AGENTS.md

Loading diff…

cmd/slides/main.go

Loading diff…

cmd/slides/shutdown_test.go

Loading diff…

fixtures/editor-entry.js

Loading diff…

fixtures/engines/saving-webkit.swift

Loading diff…

fixtures/engines/saving.mjs

Loading diff…

fixtures/save-queue.mjs

Loading diff…

fixtures/save-queue.test.mjs

Loading diff…

internal/slides/drain.go

Loading diff…

internal/slides/handlers.go

Loading diff…

internal/slides/live.go

Loading diff…

internal/slides/presentation.go

Loading diff…

internal/slides/static/editor.6401451793bdc579.js

Loading diff…

internal/slides/static/editor.edeb171c568b6ea8.js

Loading diff…

internal/slidestest/drain_test.go

Loading diff…

internal/slidestest/harness_test.go

Loading diff…

internal/slidestest/saving_browser_test.go

Loading diff…