You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/06/08 16:02:25 UTC
[GitHub] [dubbo-go] kzhan opened a new pull request #1251: Feature/grpc request timeout
kzhan opened a new pull request #1251:
URL: https://github.com/apache/dubbo-go/pull/1251
add grpc request timeout
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] LaurenceLiZhixin closed pull request #1251: Feature/grpc request timeout
Posted by GitBox <gi...@apache.org>.
LaurenceLiZhixin closed pull request #1251:
URL: https://github.com/apache/dubbo-go/pull/1251
--
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@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] zouyx commented on a change in pull request #1251: Feature/grpc request timeout
Posted by GitBox <gi...@apache.org>.
zouyx commented on a change in pull request #1251:
URL: https://github.com/apache/dubbo-go/pull/1251#discussion_r656113046
##########
File path: protocol/grpc/grpc_invoker.go
##########
@@ -150,3 +167,16 @@ func (gi *GrpcInvoker) Destroy() {
}
})
}
+
+// timeout
+func (gi *GrpcInvoker) getTimeout(invocation protocol.Invocation) time.Duration {
+ var timeout time.Duration
+ timeoutStr := gi.BaseInvoker.GetURL().GetParam(constant.METHODS_KEY+"."+invocation.MethodName()+"."+constant.TIMEOUT_KEY,
+ gi.BaseInvoker.GetURL().GetParam(constant.TIMEOUT_KEY, ""))
+ if timeoutStr != "" {
+ timeout, _ = time.ParseDuration(timeoutStr)
+ } else {
+ timeout = gi.timeout
+ }
+ return timeout
Review comment:
```suggestion
if len(timeoutStr)==0 {
timeout = gi.timeout
}
timeout, _ = time.ParseDuration(timeoutStr)
return timeout
```
what about this style?
##########
File path: protocol/grpc/grpc_invoker.go
##########
@@ -43,14 +46,23 @@ type GrpcInvoker struct {
quitOnce sync.Once
clientGuard *sync.RWMutex
client *Client
+ // timeout for service(interface) level.
+ timeout time.Duration
}
// NewGrpcInvoker returns a Grpc invoker instance
func NewGrpcInvoker(url *common.URL, client *Client) *GrpcInvoker {
+ requestTimeout := config.GetConsumerConfig().RequestTimeout
+ requestTimeoutStr := url.GetParam(constant.TIMEOUT_KEY, config.GetConsumerConfig().Request_Timeout)
+ if t, err := time.ParseDuration(requestTimeoutStr); err == nil {
Review comment:
```suggestion
if t, err := time.ParseDuration(requestTimeoutStr); err != nil {
```
Is it a right logic?
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
[GitHub] [dubbo-go] AlexStocks commented on a change in pull request #1251: Feature/grpc request timeout
Posted by GitBox <gi...@apache.org>.
AlexStocks commented on a change in pull request #1251:
URL: https://github.com/apache/dubbo-go/pull/1251#discussion_r647924692
##########
File path: protocol/grpc/grpc_invoker.go
##########
@@ -19,8 +19,10 @@ package grpc
import (
"context"
+ "dubbo.apache.org/dubbo-go/v3/config"
Review comment:
pls move it to the 3rd import block.
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org