DaWesen commented on code in PR #3695:
URL: https://github.com/apache/dubbo-go/pull/3695#discussion_r3841343336


##########
global/shutdown_config.go:
##########
@@ -92,6 +91,21 @@ func DefaultShutdownConfig() *ShutdownConfig {
        return cfg
 }
 
+// LoadLastReceivedRequestTime returns the timestamp of the last received 
request.
+// A nil pointer means no request has ever been received, which is represented 
as
+// the zero time.
+func (c *ShutdownConfig) LoadLastReceivedRequestTime() time.Time {
+       if last := c.ProviderLastReceivedRequestTime.Load(); last != nil {
+               return *last
+       }
+       return time.Time{}
+}
+
+// StoreLastReceivedRequestTime records the timestamp of the last received 
request.
+func (c *ShutdownConfig) StoreLastReceivedRequestTime(t time.Time) {
+       c.ProviderLastReceivedRequestTime.Store(&t)
+}

Review Comment:
   有必要。标准库 sync/atomic 没有 atomic.Time,只有 atomic.Pointer[T],而它的 Store(val 
*T)/Load() *T 签名都要求指针,所以 Store(&t) 这层是 API 硬性要求。



##########
common/host_util.go:
##########
@@ -44,10 +42,53 @@ func GetLocalIp() string {
        if len(localIp) != 0 {
                return localIp
        }
-       localIp, _ = gxnet.GetLocalIP()
+       localIp, _ = getLocalIP()
        return localIp
 }
 
+func getLocalIP() (string, error) {

Review Comment:
   已采用此方案



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