Skip to main content

Module check

Module check 

Source
Expand description

Throttling and suppression for background “is there a newer release?” checks.

Two rules govern when we are allowed to ask GitHub:

  1. 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.
  2. 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§

UpdateCheckCache
Cached result of the last network update check.

Enums§

SuppressionReason
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.json by 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.