This is an automated email from the ASF dual-hosted git repository.
Alanxtl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/develop by this push:
new d39c99722 fix(protocol/triple): handle ParseDuration error for
keepalive config (#3622)
d39c99722 is described below
commit d39c99722ac5104eece3bf78a98c3b0e87ae68ee
Author: Yash Israni <[email protected]>
AuthorDate: Sun Aug 9 10:31:49 2026 +0530
fix(protocol/triple): handle ParseDuration error for keepalive config
(#3622)
Signed-off-by: Yash Israni <[email protected]>
---
protocol/triple/dubbo3_invoker.go | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/protocol/triple/dubbo3_invoker.go
b/protocol/triple/dubbo3_invoker.go
index 65bd0634a..e835465ae 100644
--- a/protocol/triple/dubbo3_invoker.go
+++ b/protocol/triple/dubbo3_invoker.go
@@ -111,9 +111,16 @@ func NewDubbo3Invoker(url *common.URL) (*DubboInvoker,
error) {
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)
+ if parsedInterval, err :=
time.ParseDuration(tripleConf.KeepAliveInterval); err == nil {
+ keepAliveInterval = parsedInterval
+ } else if tripleConf.KeepAliveInterval != "" {
+ logger.Warnf("[Triple][Invoker] invalid
keepAliveInterval %q, using default %v", tripleConf.KeepAliveInterval,
keepAliveInterval)
+ }
+ if parsedTimeout, err :=
time.ParseDuration(tripleConf.KeepAliveTimeout); err == nil {
+ keepAliveTimeout = parsedTimeout
+ } else if tripleConf.KeepAliveTimeout != "" {
+ logger.Warnf("[Triple][Invoker] invalid
keepAliveTimeout %q, using default %v", tripleConf.KeepAliveTimeout,
keepAliveTimeout)
+ }
}
opts = append(opts,
triConfig.WithGRPCKeepAliveTimeInterval(keepAliveInterval))