AlinsRan opened a new pull request, #13585: URL: https://github.com/apache/apisix/pull/13585
### Description When `oas-validator` loads the OpenAPI spec from `spec_url`, a fetch/compile failure was **not cached**. A persistently failing `spec_url` (remote down, non-200, invalid JSON) therefore triggered an **outbound HTTP request on every incoming request** — failure amplification that piles up connections and latency during an outage. This adds `neg_ttl` / `neg_count` to the spec lru cache so failures are cached for a short window (5s). `core.lrucache` checks the negative cache before invoking the fetch, so repeated requests return the cached error without re-fetching, while a recovered `spec_url` is still picked up within 5s. The route still returns 500 on failure — only the redundant outbound fetches are eliminated. ### Tests `t/plugin/oas-validator3.t` TEST 24/25: a route whose `spec_url` always returns 404 is hit 3 times; a shared-dict counter on the spec endpoint asserts it was fetched once. ### Checklist - [x] I have explained the need for this PR and the problem it solves - [x] I have explained the changes or the new features added to this PR - [x] I have added tests corresponding to this change - [x] I have updated the documentation to reflect this change (N/A — internal caching, no config/behavior change) - [x] I have verified that this change is backward compatible -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
