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/08/20 02:40:15 UTC

[GitHub] [dubbo-go] xavier-niu commented on a change in pull request #1380: Fix: fix the exception when tcp timeout is less than 1s for 3.0 #1362

xavier-niu commented on a change in pull request #1380:
URL: https://github.com/apache/dubbo-go/pull/1380#discussion_r692614982



##########
File path: remoting/getty/config.go
##########
@@ -177,6 +182,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 min != nil && max != nil && *min > *max { // swap

Review comment:
       IMO, if the value is invalid, the program should go crash to make the user realize something goes wrong, instead of swapping without any warning.

##########
File path: remoting/getty/config.go
##########
@@ -177,6 +182,23 @@ func (c *GettySessionParam) CheckValidity() error {
 	return nil
 }
 
+func parseTimeDurationByRange(timeStr string, min *time.Duration, max *time.Duration) (time.Duration, error) {

Review comment:
       What if the value of `min` or  the `max` is less than 0? The boundary conditions should be fully considered.




-- 
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