totemofwolf commented on a change in pull request #976: Added password support 
for plugin limit-count-redis
URL: https://github.com/apache/incubator-apisix/pull/976#discussion_r361920025
 
 

 ##########
 File path: lua/apisix/plugins/limit-count/limit-count-redis.lua
 ##########
 @@ -51,6 +51,13 @@ function _M.incoming(self, key)
         return false, err
     end
 
+    if conf.redis_password and conf.redis_password ~= '' then
 
 Review comment:
   > we need to check if this sock was used for first time by API: 
https://github.com/openresty/lua-nginx-module#tcpsockgetreusedtimes
   > 
   > Call the `auth` if the `reusedtimes` equal 0.
   
   
   Yes, I did it as you mentioned like this:
   ```
       local count
       count, err = red:get_reused_times()
       if 0 == count then
           if conf.redis_password and conf.redis_password ~= '' then
               local ok, err = red:auth(conf.redis_password)
               if not ok then
                   return nil, err
               end
           end
       elseif err then
           -- core.log.info(" err: ", err)
           return
       end
   ```
   
   but the test cases :  
https://travis-ci.org/apache/incubator-apisix/jobs/630846147  and output logs 
of apisix make me confused.
   ```
   
   apisix_1  | 2019/12/30 15:54:58 [error] 29#29: *2911 [lua] 
limit-count.lua:127: phase_fun(): failed to limit req: ERR invalid password, 
client: 1.2.3.4, server: , request: "POST /api/admin/login HTTP/2.0", host: 
"x.nsa.work", referrer: "https://x.nsa.work/admin/index.html";
   
   apisix_1  | 1.2.3.4 - - [30/Dec/2019:15:54:58 +0800] "POST /api/admin/login 
HTTP/2.0" x.nsa.work - /api/admin/login 500 29 610 
"https://x.nsa.work/admin/index.html"; "Mozilla/5.0 (Macintosh; Intel Mac OS X 
10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 
Safari/605.1.15"  0.000 - "-"
   ```
   
   I'm wondering how to treat this pipelined_requests for ` Test 7 & 8 `
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to