fix: honor country Retry-After from response time #401

Merged
admin merged 1 commits from fix/country-retry-after-from-response into dev 2026-10-17 20:46:51 +00:00
Owner

What changed

Country discovery now starts the server-provided Retry-After window after receiving the HTTP response, rather than before the lookup request begins. A deliberately delayed rate-limit response tests that the full interval is honored from the response.

The full integration suite exposed this existing timing bug while checking #398. It explains the near-one-second assertion failure and prevents retrying earlier than the provider requested.

Verification

  • go vet ./apps/sisyphusd
  • go test -race ./apps/sisyphusd -run '^(TestARateLimitsRetryAfterIsWaitedOut|TestRetryAfterIsReadInSecondsOrAsADate|TestTheCountryIsLookedUpAgainAfterATransientFailure)$' -count=2
  • git diff --check

Part of #393.

## What changed Country discovery now starts the server-provided `Retry-After` window after receiving the HTTP response, rather than before the lookup request begins. A deliberately delayed rate-limit response tests that the full interval is honored from the response. The full integration suite exposed this existing timing bug while checking #398. It explains the near-one-second assertion failure and prevents retrying earlier than the provider requested. ## Verification - `go vet ./apps/sisyphusd` - `go test -race ./apps/sisyphusd -run '^(TestARateLimitsRetryAfterIsWaitedOut|TestRetryAfterIsReadInSecondsOrAsADate|TestTheCountryIsLookedUpAgainAfterATransientFailure)$' -count=2` - `git diff --check` Part of #393.
rvnminers-A-and-N left a comment
Owner

Same cause I tracked down independently (#402, my now-closed #403): time.Now() is evaluated before lookUpCountry runs, so Retry-After counted from the asking. Without the fix, the test failed 10 times in 180 local runs, with gaps as short as 997.6 ms. Measuring from responseAt makes the assertion exact. Approving. Could you add Closes #402 to the description so the issue closes with it?

Same cause I tracked down independently (#402, my now-closed #403): `time.Now()` is evaluated before `lookUpCountry` runs, so Retry-After counted from the asking. Without the fix, the test failed 10 times in 180 local runs, with gaps as short as 997.6 ms. Measuring from `responseAt` makes the assertion exact. Approving. Could you add `Closes #402` to the description so the issue closes with it?
Sign in to join this conversation.
No Reviewers
No labels area:daemon bug testing
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Sisyphus/Sisyphus#401