222twotwotwo commented on code in PR #142:
URL: https://github.com/apache/dubbo-getty/pull/142#discussion_r3801678617


##########
client.go:
##########
@@ -416,7 +416,28 @@ func (c *client) RunEventLoop(newSession 
NewSessionCallback) {
        c.Lock()
        c.newSession = newSession
        c.Unlock()
-       c.reConnect()
+       <-c.runReconnect()
+}
+
+func (c *client) runReconnect() <-chan struct{} {
+       done := make(chan struct{})
+       c.Lock()
+       select {
+       case <-c.done:
+               c.Unlock()
+               close(done)
+               return done
+       default:
+               c.wg.Add(1)
+       }
+       c.Unlock()
+
+       go func() {
+               defer c.wg.Done()
+               defer close(done)
+               c.reConnect()
+       }()

Review Comment:
   收到,已为重连循环引入 single‑flight 机制;同时新增回归测试



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