AlinsRan commented on code in PR #12256:
URL: https://github.com/apache/apisix/pull/12256#discussion_r2108084481


##########
apisix/core/config_yaml.lua:
##########
@@ -274,7 +275,7 @@ local function sync_data(self)
                           ", it should be an object")
             end
 
-            local id = item.id or ("arr_" .. idx)
+            local id = item.id or item.username or ("arr_" .. idx)

Review Comment:
   If not, the default is `values_hash ["arr_1"] = consumer{}`, 
   
   The filter is called after the cache is set. In the following calls, it 
cannot get the consumer
   
   
https://github.com/apache/apisix/blob/85563f016c35834763376894e45908b2fb582d87/apisix/consumer.lua#L101
   
   
https://github.com/apache/apisix/blob/85563f016c35834763376894e45908b2fb582d87/apisix/core/config_yaml.lua#L330-L335
   



##########
apisix/core/config_yaml.lua:
##########
@@ -274,7 +275,7 @@ local function sync_data(self)
                           ", it should be an object")
             end
 
-            local id = item.id or ("arr_" .. idx)
+            local id = item.id or item.username or ("arr_" .. idx)

Review Comment:
   If not, the default is `values_hash["arr_1"] = consumer{}`, 
   
   The filter is called after the cache is set. In the following calls, it 
cannot get the consumer
   
   
https://github.com/apache/apisix/blob/85563f016c35834763376894e45908b2fb582d87/apisix/consumer.lua#L101
   
   
https://github.com/apache/apisix/blob/85563f016c35834763376894e45908b2fb582d87/apisix/core/config_yaml.lua#L330-L335
   



-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to