AlexStocks commented on a change in pull request #92:
URL: https://github.com/apache/dubbo-getty/pull/92#discussion_r782959708



##########
File path: session.go
##########
@@ -873,3 +870,132 @@ func (s *session) Close() {
        s.stop()
        log.Infof("%s closed now. its current gr num is %d", s.sessionToken(), 
s.grNum.Load())
 }
+
+// GetActive return connection's time
+func (s *session) GetActive() time.Time {
+       if s == nil {
+               return launchTime
+       }
+       s.lock.RLock()
+       defer s.lock.RUnlock()
+       if s.Connection != nil {
+               return s.Connection.GetActive()
+       }
+       return launchTime
+}
+
+// UpdateActive update connection's active time
+func (s *session) UpdateActive() {
+       if s == nil {
+               return
+       }
+       s.lock.RLock()
+       if s.Connection != nil {
+               s.Connection.UpdateActive()
+       }
+       s.lock.RUnlock()

Review comment:
       你说你们有多无聊,在这里争论 defer 性能,defer 性能现在优化的很好了




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

Reply via email to