Repository navigation
fix(api-cache): wait as long as a refusing query server asks (#889) - #925
Merged
Merged
Conversation
A query server that refuses a query (503/429 with Retry-After) names the time it will take the query again. nanopub-java 1.96.0 passes that on as QueryRefusedException: - ApiCache waits until that time before the next attempt, though never less than the backoff step for the failure count and never more than five minutes. - QueryApiAccess.forcedGet hands a refusal to the caller instead of asking again for 30 seconds, which sent a refusing server about 15 requests per attempt. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 5.23.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Part of #889. Follow-up to #890, possible now that nanopub 1.96.0 (pinned in #924) reports a query server's refusal as
QueryRefusedExceptionwith the server's Retry-After time.Changes
ApiCachewaits until then before the next attempt — never less than the backoff step for the failure count (10 s / 30 s / 1 min / 5 min), never more than 5 minutes.QueryApiAccess.forcedGethands a refusal to the caller instead of asking again for 30 seconds.forcedGetstill retries for up to 30 seconds on other failures (timeouts, unreachable); that is unchanged.Testing
mvn testpasses (1890 tests); three new tests inApiCacheTestandQueryApiAccessTest.NANOPUB_QUERY_INSTANCESpointing at a proxy to the live query service that answers 503 withRetry-After: 45for queries mentioning a marker IRI. Fresh visits to/explore?id=<marker>every 15 s: each of the page's five queries was sent once, logged "not trying it again for 44s", was not sent on the visits 15 s and 30 s later, and was sent once more after 45 s. The plain backoff would have retried after 10 s.get-all-user-introsduring startup (Retry-After: 4): one request, then the ordinary 10 s step, since that is the longer of the two.🤖 Generated with Claude Code