Wangzy455 commented on code in PR #898:
URL:
https://github.com/apache/incubator-seata-go/pull/898#discussion_r2384170678
##########
pkg/remoting/getty/getty_client.go:
##########
@@ -106,6 +110,29 @@ func (g *GettyRemotingClient) syncCallback(reqMsg
message.RpcMessage, respMsg *m
}
}
+func (client *GettyRemotingClient) reconnectWithBackoff(session getty.Session,
maxRetries int) {
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
+ cfg := backoff.Config{
+ MinBackoff: 1 * time.Second,
+ MaxBackoff: 60 * time.Second,
+ MaxRetries: maxRetries,
+ }
+ backoffInstance := backoff.New(ctx, cfg)
+
+ log.Infof("Starting reconnection attempts with backoff for session:
%s", session.Stat())
+
+ for backoffInstance.Ongoing() {
+ backoffInstance.Wait()
+
+ log.Infof("Reconnection attempt %d for session: %s",
backoffInstance.NumRetries(), session.Stat())
+ }
+
+ if err := backoffInstance.Err(); err != nil {
+ log.Errorf("Reconnection failed after %d attempts: %v",
backoffInstance.NumRetries(), err)
+ }
+}
Review Comment:
done
##########
pkg/remoting/getty/listener.go:
##########
@@ -143,3 +145,8 @@ func (g *gettyClientHandler) RegisterProcessor(msgType
message.MessageType, proc
g.processorMap[msgType] = processor
}
}
+
+func (g *gettyClientHandler) cleanupSession(session getty.Session) {
+ session.RemoveAttribute(heartBeatRetryTimesKey)
+ log.Debugf("Cleaned up resources for closing session: %s",
session.Stat())
+}
Review Comment:
done
--
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]