nic-6443 commented on code in PR #14061:
URL: https://github.com/apache/apisix/pull/14061#discussion_r4355789796


##########
apisix/plugins/oas-validator.lua:
##########
@@ -234,11 +281,16 @@ local function get_validator(conf)
         end
         cache_key = cache_key .. "#" .. ngx_md5(tab_concat(parts, "&"))
     end
-    local validator, err = lrucache(cache_key, nil, fetch_and_compile, conf)
-    if not validator then
+
+    -- Key by the declaring resource with the URL key as version, so a changed
+    -- spec_url replaces the resource's slot instead of adding another one.
+    local entry, err = lrucache(conf._meta.parent.resource_key, cache_key,
+                                create_spec_url_entry, conf, cache_key,
+                                spec_url_lrucache_ttl)

Review Comment:
   Agreed. This came from the per-resource slot getting its own TTL, and that's 
gone in 5d1d17e: there's one entry per URL again, with master's TTL and refresh 
behaviour, so a request after the spec is older than `spec_url_ttl` is served 
stale and queues a refresh exactly like on master, whichever resource made the 
first fetch. TEST 30 in `oas-validator3.t` covers your sequence (route A 
fetches, route B reuses it near expiry, B's next request after the TTL triggers 
the refetch).
   



-- 
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]

Reply via email to