Repository navigation
Updater: fresh release list on Settings, System, Check for updates, and Update now - #462
Merged
Merged
Conversation
…pdates, and Update now Opening Settings, System reads GitHub's release list again when the copy is over two minutes old; Check for updates (POST /api/system/releases/check, install admins) reads it now. At most one read per 30 seconds per install, each conditional on the ETag. Update now with no version reads the list first and installs the newest release at that moment. A release latest.json names that the list lacks is never undercut by an older one. The hourly check stays.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A self-hosted install saw a new release only up to an hour after it was published, because the updater kept GitHub's release list for an hour. Opening Settings, System didn't refresh it, and neither did invoking the updater. Seen live: v0.8.32 was published at 17:22 UTC, the install had last read the list at 16:51, and the page kept offering v0.8.31 (known broken) until the hour ran out.
Changes
status) reads the list again when the copy is more than 2 minutes old. The hourly background check still keeps its copy for an hour.statuswithrefreshreads the list right away. The new gateway routePOST /api/system/releases/checksends it. Only team admins who are also install admins can call it (may_check_releases, plus the usualrequire_role(3)), and it is listed under thesystemcapability.releases.error. Every read sendsIf-None-Matchwith the stored ETag. A 304 counts as a check, keeps the list and uses no API quota.launch/latest.jsonas a hint, also with its ETag and the same limits. If the hint names a release the cached list lacks, the list is read again. If the newer release still isn't listed (latest.json, or the newest stable release seen before), nothing older is offered.statusreturnslatest: nullwithreleases.behind,update_nowrefuses, and the hourly check neither installs nor sends a notice. If a release is still missing after 24 hours, it is treated as withdrawn and the list is used as it is.docs/self-host/updates.md: how updates are found.Verification
python3 -m unittest discover -s lambda/tests: 312 passed. New tests cover:fetch_latestcargo fmt --check,cargo clippy -p gateway --all-targets -- -D warnings,cargo test -p gateway: 695 passed, includingonly_install_admins_may_check_for_releasesand the permissions-table route check.