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/07/04 02:46:24 UTC

[GitHub] [dubbo-go] mark4z commented on a change in pull request #1293: performance optimization: change time.After => time.NewTimer

mark4z commented on a change in pull request #1293:
URL: https://github.com/apache/dubbo-go/pull/1293#discussion_r663436520



##########
File path: protocol/grpc/server.go
##########
@@ -115,7 +115,8 @@ func waitGrpcExporter(providerServices map[string]*config.ServiceConfig) {
 	t := time.NewTicker(50 * time.Millisecond)
 	defer t.Stop()
 	pLen := len(providerServices)
-	ta := time.After(10 * time.Second)
+	ta := time.NewTimer(10 * time.Second)
+	defer ta.Stop()

Review comment:
       It is indeed necessary to call B once when the timeout use defer, but it is too complicated to set the flag in each branch. defer is obviously a bit more concise.




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