Skip to content

fix: stamp update-check cooldown only after a successful fetch - #321

Open
Borisserz wants to merge 1 commit into
chattymin:mainfrom
Borisserz:fix/update-check-cooldown-only-on-success
Open

Borisserz wants to merge 1 commit into
chattymin:mainfrom
Borisserz:fix/update-check-cooldown-only-on-success

Conversation

@Borisserz

Copy link
Copy Markdown
Contributor

Summary

Fixes #320.

  • UpdateChecker.check() stamped lastChecked before the GitHub request finished. A failed lookup (offline, timeout, bad payload) still started the 30-minute cooldown, so reopening the popover stayed silent even though no release was seen.
  • Stamp the cooldown only after a trusted https://github.com release URL is accepted. Inject a fetch double in tests so the suite does not hit the network.
  • Add an in-flight guard so overlapping popover opens do not stack concurrent requests once the early stamp is gone.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • Other:

Checklist

  • swift build and swift test pass locally (1081 tests, 13 skipped, 0 failures)
  • PR title and description are written in English
  • No copyrighted assets, secrets, or private tooling references are committed (see CONTRIBUTING)
  • Tests were added or updated for this change

Test plan

  • testFailedCheckDoesNotStartTheCooldown fails when lastChecked is stamped before fetch, then passes
  • testSuccessfulCheckStartsTheCooldownAndAppliesTheRelease passes
  • testRejectedReleaseUrlDoesNotStartTheCooldown passes
  • swift build and swift test locally: 1081 passed, 13 skipped, 0 failed
  • CI swift test

A failed GitHub lookup was setting lastChecked first, so opening the popover again stayed silent for 30 minutes even though no release was seen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed update check starts a 30-minute cooldown and blocks retries

1 participant