Notes: an upper limit on the save delay while someone types nonstop #297

Closed
opened 2026-10-14 14:40:36 +00:00 by kayg · 2 comments
Owner

Found in #289. A note's room saves the file only after a quiet gap (750 ms in production). Someone who types nonstop in one note keeps postponing the file write. History holds every change, so nothing is lost, but the .md on disk (which outside tools, sync and backups see) can lag for minutes.

Proposal: add a maximum delay, so the file is written at least every N seconds (e.g. 5 s) while edits keep arriving. Writes stay atomic. Measure the cost on a big note at 100k notes and keep it within perf/budgets.json.

Found in #289. A note's room saves the file only after a quiet gap (750 ms in production). Someone who types nonstop in one note keeps postponing the file write. History holds every change, so nothing is lost, but the .md on disk (which outside tools, sync and backups see) can lag for minutes. **Proposal:** add a maximum delay, so the file is written at least every N seconds (e.g. 5 s) while edits keep arriving. Writes stay atomic. Measure the cost on a big note at 100k notes and keep it within perf/budgets.json.
Author
Owner

PR #408: a save at least 5 s after the first unsaved change while edits keep arriving (Options::flush_max), test included. Measured with the #44 harness at 10k and 100k notes: every budget holds; typing CPU stays at 0.6 % at 100k, wake-ups go from 41 to 56 per second while typing. Table on #298 (comment 50670).

PR #408: a save at least 5 s after the first unsaved change while edits keep arriving (`Options::flush_max`), test included. Measured with the #44 harness at 10k and 100k notes: every budget holds; typing CPU stays at 0.6 % at 100k, wake-ups go from 41 to 56 per second while typing. Table on #298 (comment 50670).
Author
Owner

Closing during the 26 Oct handover cleanup: The save-delay upper limit landed in dev (PR #408).

Closing during the 26 Oct handover cleanup: The save-delay upper limit landed in dev (PR #408).
kayg closed this issue 2026-10-26 08:46:07 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#297
No description provided.