You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/05/31 10:00:25 UTC

[GitHub] [apisix] spacewander opened a new pull request #4345: fix(ext-plugin): when token is stale, refresh token and try again

spacewander opened a new pull request #4345:
URL: https://github.com/apache/apisix/pull/4345


   Signed-off-by: spacewander <sp...@gmail.com>
   
   ### What this PR does / why we need it:
   <!--- Why is this change required? What problem does it solve? -->
   <!--- If it fixes an open issue, please link to the issue here. -->
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
   


-- 
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:
users@infra.apache.org



[GitHub] [apisix] tzssangglass commented on a change in pull request #4345: fix(ext-plugin): when token is stale, refresh token and try again

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #4345:
URL: https://github.com/apache/apisix/pull/4345#discussion_r642610119



##########
File path: apisix/plugins/ext-plugin/init.lua
##########
@@ -547,6 +533,34 @@ local function create_lrucache()
 end
 
 
+function _M.communicate(conf, ctx)
+    local ok, err, code, body
+    local tries = 0
+    while tries < 3 do
+        tries = tries + 1
+        ok, err, code, body = rpc_call(constants.RPC_HTTP_REQ_CALL, conf, ctx)
+        if ok then
+            if code then
+                return code, body
+            end
+

Review comment:
       why is there a blank line here?

##########
File path: apisix/plugins/ext-plugin/init.lua
##########
@@ -547,6 +533,34 @@ local function create_lrucache()
 end
 
 
+function _M.communicate(conf, ctx)
+    local ok, err, code, body
+    local tries = 0
+    while tries < 3 do
+        tries = tries + 1
+        ok, err, code, body = rpc_call(constants.RPC_HTTP_REQ_CALL, conf, ctx)
+        if ok then
+            if code then
+                return code, body
+            end
+
+            return
+        end
+
+        if not core.string.find(err, "conf token not found") then

Review comment:
       can we use code to determine this, I'm not sure




-- 
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:
users@infra.apache.org



[GitHub] [apisix] spacewander merged pull request #4345: fix(ext-plugin): when token is stale, refresh token and try again

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #4345:
URL: https://github.com/apache/apisix/pull/4345


   


-- 
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:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #4345: fix(ext-plugin): when token is stale, refresh token and try again

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4345:
URL: https://github.com/apache/apisix/pull/4345#discussion_r642716959



##########
File path: apisix/plugins/ext-plugin/init.lua
##########
@@ -547,6 +533,34 @@ local function create_lrucache()
 end
 
 
+function _M.communicate(conf, ctx)
+    local ok, err, code, body
+    local tries = 0
+    while tries < 3 do
+        tries = tries + 1
+        ok, err, code, body = rpc_call(constants.RPC_HTTP_REQ_CALL, conf, ctx)
+        if ok then
+            if code then
+                return code, body
+            end
+

Review comment:
       To make the `return` easy to find.




-- 
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:
users@infra.apache.org



[GitHub] [apisix] spacewander commented on a change in pull request #4345: fix(ext-plugin): when token is stale, refresh token and try again

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #4345:
URL: https://github.com/apache/apisix/pull/4345#discussion_r642717148



##########
File path: apisix/plugins/ext-plugin/init.lua
##########
@@ -547,6 +533,34 @@ local function create_lrucache()
 end
 
 
+function _M.communicate(conf, ctx)
+    local ok, err, code, body
+    local tries = 0
+    while tries < 3 do
+        tries = tries + 1
+        ok, err, code, body = rpc_call(constants.RPC_HTTP_REQ_CALL, conf, ctx)
+        if ok then
+            if code then
+                return code, body
+            end
+
+            return
+        end
+
+        if not core.string.find(err, "conf token not found") then

Review comment:
       Yes




-- 
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:
users@infra.apache.org