Mulavar commented on a change in pull request #1388:
URL: https://github.com/apache/dubbo-go/pull/1388#discussion_r691744257
##########
File path: remoting/getty/config.go
##########
@@ -179,6 +184,23 @@ func (c *GettySessionParam) CheckValidity() error {
return nil
}
+func parseTimeDurationByRange(timeStr string, min time.Duration, max
*time.Duration) (time.Duration, error) {
+ result, err := time.ParseDuration(timeStr)
+ if err != nil {
+ return min, err
+ }
+ if max != nil && min > *max {
Review comment:
另外这一段替换是否有必要,方法参数名已经完全能够说明参数含义,如果从健壮性角度看 min 是否也得判空,而且感觉这段逻辑不太能起到保护作用,假如
max 传个比 min 小的 0.8s 啥的也容易出 panic。
个人建议可以直接返回 min>max 的 error 就好。
--
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]