-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define Struct::Status in Ruby #19939
Conversation
1.24 release blocker (not 1.23) |
return nil if binstatus.nil? | ||
|
||
# Lazily load grpc_c and protobuf_c.so for users of this method. | ||
require_relative './grpc' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think we can remove the corresponding logic from the caller of this in errors.rb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Updated.
@@ -15,6 +15,7 @@ | |||
ssl_roots_path = File.expand_path('../../../../etc/roots.pem', __FILE__) | |||
|
|||
require_relative 'grpc/errors' | |||
require_relative 'grpc/structs' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: requiring this is redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, but if other Structs are moved to Ruby then they should be loaded before grpc_c
. I put the require here to be explicit about it.
@apolcyn Would you like me to squash the commits? |
@@ -12,9 +12,6 @@ | |||
# See the License for the specific language governing permissions and | |||
# limitations under the License. | |||
|
|||
require_relative './grpc' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: though perhaps redundant, require structs
here, since this file uses that type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Added.
@@ -57,9 +59,6 @@ def to_status | |||
# | |||
# @return [Google::Rpc::Status, nil] | |||
def to_rpc_status | |||
# Lazily require google_rpc_status_utils to scope | |||
# loading protobuf_c.so to the users of this method. | |||
require_relative './google_rpc_status_utils' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it's outside of the scope of this PR, but while we're here, can we also remove the two lines below here: I believe they are dead/unused code.
E.g. this could be change to just GoogleRpcStatusUtils.extract_google_rpc_status(to_status)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I've made this change and the end2end script continues to pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but with two remaining nits. Please squash down commits too, thanks
Update error end2end test for loading when calling to_status. Update error end2end test for loading when calling to_rpc_status.
7ef84ce
to
0f8dced
Compare
Thanks! |
This change defines
Struct::Status
in Ruby instead of ingrpc_c
. This corrects an issue withGRPC::BadStatus
still depending ongrpc_c
that was discussed in #19893 (comment).