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 2022/05/24 08:59:31 UTC

[GitHub] [apisix] spacewander opened a new pull request, #7116: fix(grpc-transcode): pb_option should be be set on the route

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

   Signed-off-by: spacewander <sp...@gmail.com>
   
   ### Description
   
   <!-- Please include a summary of the change and which issue is fixed. -->
   <!-- Please also include relevant motivation and context. -->
   
   Fixes #7025
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [ ] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] spacewander commented on a diff in pull request #7116: fix(grpc-transcode): pb_option should be set on the route

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #7116:
URL: https://github.com/apache/apisix/pull/7116#discussion_r881125836


##########
apisix/plugins/grpc-transcode/util.lua:
##########
@@ -51,6 +53,35 @@ function _M.find_method(proto, service, method)
 end
 
 
+function _M.set_options(proto, options)
+    local cur_opts = proto.options
+    if cur_opts then
+        if cur_opts == options then
+            return
+        end
+
+        local same = true
+        table.sort(options)
+        for i, v in ipairs(options) do
+            if cur_opts[i] ~= v then
+                same = false
+                break
+            end
+        end

Review Comment:
   Good catch!



-- 
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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] bisakhmondal commented on a diff in pull request #7116: fix(grpc-transcode): pb_option should be set on the route

Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on code in PR #7116:
URL: https://github.com/apache/apisix/pull/7116#discussion_r880476205


##########
apisix/plugins/grpc-transcode/util.lua:
##########
@@ -51,6 +53,35 @@ function _M.find_method(proto, service, method)
 end
 
 
+function _M.set_options(proto, options)
+    local cur_opts = proto.options
+    if cur_opts then
+        if cur_opts == options then
+            return
+        end
+
+        local same = true
+        table.sort(options)
+        for i, v in ipairs(options) do
+            if cur_opts[i] ~= v then
+                same = false
+                break
+            end
+        end

Review Comment:
   I assume the extra check of pointer and values are for perf improvements. But just a small heads up, this check will fail on the second time the `set_option` method is called and on the first call, the `cur_opts` was nil.
   
   In that scenario, at the first run, the unsorted table will be cached - L81.
   L66 will try to match with the sorted table `options`. 
   
   Anyway, just a small nitpicking indeed : )
   



-- 
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-unsubscribe@apisix.apache.org

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


[GitHub] [apisix] spacewander merged pull request #7116: fix(grpc-transcode): pb_option should be set on the route

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


-- 
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-unsubscribe@apisix.apache.org

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