prefetch: only admit query-key requests that carry the key#13370
Open
mlibbey wants to merge 1 commit into
Open
prefetch: only admit query-key requests that carry the key#13370mlibbey wants to merge 1 commit into
mlibbey wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the prefetch plugin’s front-end/first-pass admission logic so --fetch-query only enables prefetch handling when the incoming request actually carries the configured query key, preventing unnecessary pattern processing and related error logs.
Changes:
- Gate
handleFetchon presence of the configured query key in the request’s pristine URL query string (instead of only on configuration). - Avoid extra “failed to process the pattern” error paths when no prefetch can be scheduled.
With --fetch-query configured, the front-end/first-pass gate set handleFetch=true whenever the query key was *configured*, not when the request carried it. So every request whose path matched no fetch-path-pattern was admitted anyway, ran the pattern replace, failed, and logged ERROR "failed to process the pattern" -- while scheduling no prefetch at all (BgFetch runs only on the success path). Admit only when the request's query actually contains the key, matched as a "<key>=" parameter rather than a substring (which could hit another parameter's name or value). The same parameter test is now used by the hasValidQuery branch selector and the query-branch loop as well.
d248eba to
cdc7088
Compare
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.
With --fetch-query configured, the front-end/first-pass gate set handleFetch=true whenever the query key was configured, not when the request actually carried it. So every request whose path matched no fetch-path-pattern was admitted anyway, ran the pattern replace, failed, and logged ERROR "failed to process the pattern" -- while scheduling no prefetch at all (BgFetch runs only on the success path).