Skip to content
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

feat: sort out triple logic and fix comments #2454

Merged

Conversation

DMwangnima
Copy link
Contributor

@DMwangnima DMwangnima commented Oct 22, 2023

This PR aims to sort out Triple logic and support compatibility between Triple adaptation code and Dubbo3 generated client stub code

@DMwangnima
Copy link
Contributor Author

"XXX_TRIPLE_GO_INTERFACE_NAME" lint problem solved in #2456 should be tagged to be ignored since old triple generated code could not be changed.

@chickenlj
Copy link
Contributor

"XXX_TRIPLE_GO_INTERFACE_NAME" lint problem solved in #2456 should be tagged to be ignored since old triple generated code could not be changed.

Could you please add an ignore annotation for it?

@chickenlj
Copy link
Contributor

Or we need protoc-gen-triple plugin to suport it?

@DMwangnima
Copy link
Contributor Author

"XXX_TRIPLE_GO_INTERFACE_NAME" lint problem solved in #2456 should be tagged to be ignored since old triple generated code could not be changed.

Could you please add an ignore annotation for it?

It is only a golangci-lint problem and we can not fix it referring to #2456 (define a custom type) since stub code generated by protoc-gen-go-triple makes use of "XXX_TRIPLE_GO_INTERFACE_NAME" directly.
image

I would add an ignoring annotation.

@DMwangnima DMwangnima changed the title [WIP] feat: sort out triple logic and fix comments feat: sort out triple logic and fix comments Nov 2, 2023
Copy link

sonarqubecloud bot commented Nov 3, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 88 Code Smells

No Coverage information No Coverage information
4.3% 4.3% Duplication

// consumer config client connectTimeout
//connectTimeout := config.GetConsumerConfig().ConnectTimeout
// set timeout
timeout := url.GetParamDuration(constant.TimeoutKey, "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand it right, this url contains the complete configuration of a specific service? I think we need to call something like below to get the method level timeout configuration:

timeout := url.GetMethodParamDuration(constant.TimeoutKey, "")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the default timeout value for (constant.TimeoutKey, "")?

Copy link
Contributor

@chickenlj chickenlj Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized something. Are we in the middle of an RPC invoke here? If not, we might not be able to get the method name needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specific method level timeout (optional) passed in with ctx in TripleInvoker.invoke(ctx), then to clientManager.callUnary/callClientStream(). If timeout presents in ctx, then it will be used as the timeout value; If not, the default value calculated here by timeout := url.GetParamDuration(constant.TimeoutKey, "") will be used.

Is the above process right?

Copy link
Contributor Author

@DMwangnima DMwangnima Nov 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specific method level timeout (optional) passed in with ctx in TripleInvoker.invoke(ctx), then to clientManager.callUnary/callClientStream(). If timeout presents in ctx, then it will be used as the timeout value; If not, the default value calculated here by timeout := url.GetParamDuration(constant.TimeoutKey, "") will be used.

Is the above process right?

Yes, that is. The ctx used by users would have highest priority. It is more ideal for uses to use ctx to specify timeout for method level since they can use cancel function directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized something. Are we in the middle of an RPC invoke here? If not, we might not be able to get the method name needed.

We are in the process of Refer, i.e. initialize client and some general configurations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The specific method level timeout (optional) passed in with ctx in TripleInvoker.invoke(ctx), then to clientManager.callUnary/callClientStream(). If timeout presents in ctx, then it will be used as the timeout value; If not, the default value calculated here by timeout := url.GetParamDuration(constant.TimeoutKey, "") will be used.
Is the above process right?

Yes, that is. The ctx used by users would have highest priority. It is more ideal for uses to use ctx to specify timeout for method level since they can use cancel function directly.

I see, this sounds reasonable to me.

One more thing, we need to check the method level timeout if ctx is not set, then put method timeout into ctx.

func NewDubbo3Invoker(url *common.URL) (*DubboInvoker, error) {
rt := config.GetConsumerConfig().RequestTimeout

timeout := url.GetParamDuration(constant.TimeoutKey, rt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also consider method timeout.

Copy link
Contributor

@chickenlj chickenlj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@chickenlj chickenlj merged commit 5e31152 into apache:feature-triple Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants