jlaupa commented on code in PR #13707:
URL: https://github.com/apache/apisix/pull/13707#discussion_r3655813400


##########
apisix/consumer.lua:
##########
@@ -272,10 +475,19 @@ end
 
 
 function _M.consumers_kv(plugin_name, consumer_conf, key_attr)
-    local consumers = lrucache("consumers_key#" .. plugin_name, 
consumer_conf.conf_version,
-        create_consume_cache, consumer_conf, key_attr)
+    -- consumer_conf is the per-plugin node set from _M.plugin(); the 
key_value ->
+    -- consumer map is cached on it and maintained incrementally by kv_upsert/
+    -- kv_remove, so it is not rebuilt on every conf_version change. Rebuild 
only on
+    -- first use, a key_attr change, or a version gap the incremental path 
missed.
+    if consumer_conf.kv and consumer_conf.key_attr == key_attr

Review Comment:
   Fixed in d9317ba. The per-plugin key map now carries a TTL (300s, matching 
the
   refresh bound the previous global lru-cache provided): `consumers_kv()` 
rebuilds
   the map once the TTL lapses even without a `conf_version` change, so
   secret-backed auth values are re-derived within that bound although 
`/secrets`
   changes don't bump `conf_version`. Incremental upserts still apply structural
   changes immediately — the TTL only bounds secret drift.



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