Skip to content

Saves wait for a 5 s rest: fewer full rewrites into Sync history (#274) - #278

Merged
Joost-8 merged 1 commit into
mainfrom
claude/issue-274-per-page-de39f4
Nov 21, 2026
Merged

Joost-8 merged 1 commit into
mainfrom
claude/issue-274-per-page-de39f4

Conversation

@OskarRabenda

Copy link
Copy Markdown
Collaborator

Refs #274. This is the quick mitigation, not the fix. The per-page storage design is on a review page and needs Joost's and Oskar's decision before the file format changes.

Problem: every save rewrites the whole notebook (about 1.6 MB for the reporter's 30 pages), and Obsidian Sync keeps each write as a version for a month, counted against the plan. A model of an hour of note-taking, run through Obsidian's 2 s requestSave and WriteHold, gives about 246 saves an hour, so about 390 MB a writing hour.

Change:

  • A save now waits until the pen has rested 5 s (SAVE_QUIET_MS, was 1 s), and at most 60 s (MAX_SAVE_HOLD_MS, was 20 s). That is about 56 saves an hour.
  • These keep the 1 s quiet (QUIET_MS): PDF rasterising and the background save worker's wait for the pen.
  • A pen held down 20 s still counts as a lost lift (LOST_LIFT_MS).
  • A save Obsidian asks for after the pen's quiet timer has already run gets a timer of its own. Without it, that save would wait for the next stroke.

Trade-off on the iPad:

  • Still saved at once: leaving the app (visibilitychange), closing the notebook, opening another file in the tab, unloading.
  • If Obsidian crashes or is ended while the notebook is on screen, typically the last 5 s of ink is lost instead of 1–3 s. At most it is 60 s of writing without a single 5 s pause.

What it does not fix: a heavy user still passes 1 GB a month, and notebooks still pass Sync Standard's 5 MB per-file limit (near page 90 at the reporter's density).

Tested:

  • CI gates pass: typecheck, lint, lint:review, format:check, test, build.
  • tests/view/write-hold.test.ts and tests/view/ink-view-file.test.ts cover the three waits, the late Obsidian save and the overdue save while writing.
  • Not run on an iPad, and not tested against a real Sync account.

🤖 Generated with Claude Code

Every save rewrites the whole notebook, and Obsidian Sync keeps each write
as a version for a month. A save now waits until the pen has rested 5 s
(was 1 s) and at most 60 s (was 20 s): about 56 saves an hour of writing
instead of about 246. PDF rasterising and the background save worker keep
the 1 s quiet; a pen held down 20 s still counts as a lost lift. Leaving the
app, closing the notebook and unloading still save at once.

A save Obsidian asks for after the pen's quiet timer has run now gets a
timer of its own, so it is not left waiting for the next stroke.

Refs #274

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Joost-8
Joost-8 merged commit 9e3be31 into main Nov 21, 2026
1 check passed
@Joost-8
Joost-8 deleted the claude/issue-274-per-page-de39f4 branch November 21, 2026 15:13
@Joost-8

Joost-8 commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Thanks Oskar, merged as it was in #286, together with #279. One correction for the #274 reply: Obsidian Sync already uploads a file over 100 KB at most every 30 s, so today's cost is about 190 MB per hour of writing, not 390. This brings it to about 90 MB, so roughly 2× less, not 4×.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants