Skip to content

Domain store: skip writes that change nothing, space the rest five seconds apart - #317

Merged
Mpdreamz merged 2 commits into
mainfrom
fix/domain-write-churn
Nov 22, 2026
Merged

Mpdreamz merged 2 commits into
mainfrom
fix/domain-write-churn

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

macOS flagged Heed three times (Nov 19 twice, Nov 21) for excessive disk writes: DomainStore.flush() rewriting the ~3 MB domain.json at 650 KB/s to 1.3 MB/s for 30 to 55 minutes while idle.

  • apply schedules a write only when the domain actually changed.
  • Writes are at least minimumInterval (5 s) apart. A hard crash can lose the last few seconds of the cache; flushAll on quit still writes at once.

This caps the rate whatever feeds it. If a timer commits real changes (a changing timestamp, say), the cause is still there; #316's heartbeat logs which change kinds reach the store, so it can be found.

Tests: unchanged apply writes nothing, a real change is written, writes wait out the interval, flushAll ignores it. I broke the unchanged check and the spacing on purpose and each made a test fail. Full suite and lint pass.

Separate from #316 (diagnostics), per the correctness/behaviour split.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the bug Something isn't working label Nov 22, 2026
@Mpdreamz
Mpdreamz force-pushed the fix/domain-write-churn branch from 39f284f to bd9cc37 Compare November 22, 2026 15:23
…at least five seconds apart

domain.json is about 3 MB, and Heed rewrote it every few seconds for 30 to 55 minutes while left alone, which macOS
flagged three times for excessive disk writes. A change that leaves the domain as it was no longer schedules a write,
and writes are spaced minimumInterval (5 s) apart. Quitting still writes at once.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz
Mpdreamz force-pushed the fix/domain-write-churn branch from 7eae38e to 6d26f76 Compare November 22, 2026 21:05
@Mpdreamz
Mpdreamz merged commit d1241c2 into main Nov 22, 2026
9 of 10 checks passed
@Mpdreamz
Mpdreamz deleted the fix/domain-write-churn branch November 22, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant