Copilot commented on code in PR #2900:
URL: https://github.com/apache/dubbo-go/pull/2900#discussion_r2113404020
##########
protocol/triple/dubbo3_invoker.go:
##########
@@ -97,9 +98,21 @@ func NewDubbo3Invoker(url *common.URL) (*DubboInvoker,
error) {
}
opts = append(opts,
triConfig.WithGRPCMaxCallRecvMessageSize(maxCallRecvMsgSize))
opts = append(opts,
triConfig.WithGRPCMaxCallSendMessageSize(maxCallSendMsgSize))
+
// grpc keepalive config
+ // Deprecated:use tripleconfig
+ // TODO: remove KeepAliveInterval and KeepAliveInterval in version 4.0.0
keepAliveInterval := url.GetParamDuration(constant.KeepAliveInterval,
constant.DefaultKeepAliveInterval)
keepAliveTimeout := url.GetParamDuration(constant.KeepAliveTimeout,
constant.DefaultKeepAliveTimeout)
+
+ tripleConfRaw, ok := url.GetAttribute(constant.TripleConfigKey)
+ if ok {
+ tripleConf := tripleConfRaw.(*global.TripleConfig)
+ // TODO: handle ParseDuration error
+ keepAliveInterval, _ =
time.ParseDuration(tripleConf.KeepAliveInterval)
+ keepAliveTimeout, _ =
time.ParseDuration(tripleConf.KeepAliveTimeout)
Review Comment:
Consider handling the error returned from time.ParseDuration instead of
ignoring it, to avoid unintended behavior when a malformed duration is provided.
```suggestion
// Handle ParseDuration error
parsedInterval, err :=
time.ParseDuration(tripleConf.KeepAliveInterval)
if err != nil {
logger.Errorf("Failed to parse KeepAliveInterval: %v,
using default value %v", err, keepAliveInterval)
} else {
keepAliveInterval = parsedInterval
}
parsedTimeout, err :=
time.ParseDuration(tripleConf.KeepAliveTimeout)
if err != nil {
logger.Errorf("Failed to parse KeepAliveTimeout: %v,
using default value %v", err, keepAliveTimeout)
} else {
keepAliveTimeout = parsedTimeout
}
```
##########
protocol/triple/options.go:
##########
@@ -17,30 +17,78 @@
package triple
-type ServerOptions struct {
+import (
+ "time"
+)
+
+import (
Review Comment:
[nitpick] Consider combining the two separate import blocks into a single
import statement for improved readability and maintainability.
```suggestion
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]