mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-29 17:21:13 +01:00
Every host report, accepted or rejected, rewrote host_continuity.json in full. The journal holds one entry per host and every host reports every 30 seconds, so its write volume grew with the square of the fleet. An strace of a Pulse fed by 30 synthetic agents put it at about 1.5 GiB/day, the largest writer after metrics.db. ObserveReport now writes a new host, and any identity, credential, link, legacy, tombstone or report-stream change, before the report returns, as before. A change confined to receipt times, the accepted time and the sequence within the same stream updates memory at once and reaches disk within 15 seconds, at the next synchronous write, or when Monitor.Stop closes the store. Ordering decisions read memory, so a running process behaves as before, and restarts and upgrades resume from the exact watermark. Only a crash can lose up to 15 seconds of sequence advance; the journal was never fsynced, so a crash could already lose the last rewrite. The Docker report-order journal keeps writing per report, because a failed write there deliberately rejects the report. Measured on pulse-dev with the nightly watch's agent estate, main against main plus this change: disk writes 6.3 -> 5.0 GiB/day, with memory, CPU and accepted reports unchanged. internal/config, internal/monitoring and the host agent internal/api tests pass.