Expand description
Throttling and suppression for background “is there a newer release?” checks.
Two rules govern when we are allowed to ask GitHub:
- Not in CI, and not when the user said no. A build agent has no one to tell, and an outbound request from a sandboxed runner is at best noise and at worst a firewall alert.
- At most once per interval. The answer changes on release cadence, not on launch cadence, so it is cached on disk and reused.
The cache stores the answer (the latest tag), not merely a “checked recently” flag. That distinction matters: a stale-binary user who relaunches ten times in an hour should still see the notice every time, while the network is touched at most once. Caching only a timestamp — and returning “no update” on a cache hit — would hide the notice for the whole interval, which is the opposite of what the feature is for.
Structs§
- Update
Check Cache - Cached result of the last network update check.
Enums§
- Suppression
Reason - Why an update check was skipped without contacting the network.
Constants§
- DEFAULT_
CHECK_ INTERVAL_ HOURS - Default hours between network update checks.
- UPDATE_
CHECK_ CACHE_ FILE - Filename of the on-disk update-check cache, relative to the CodeWhale home
directory (
~/.codewhale/update-check.jsonby default).
Functions§
- cache_
path_ in - Resolve the cache path inside a CodeWhale home directory.
- now_
unix - Current Unix time in seconds, saturating at 0 for pre-epoch clocks.
- suppression_
reason - Returns the reason update checks are suppressed in this process, if any.