Skip to content

Commit

Permalink
lilou-1294 fix the issue that the sticky client is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
smallnest committed Apr 2, 2024
1 parent aec5225 commit b0e1cff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/xclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ func filterByStateAndGroup(group string, servers map[string]string) {
// selects a client from candidates base on c.selectMode
func (c *xClient) selectClient(ctx context.Context, servicePath, serviceMethod string, args interface{}) (string, RPCClient, error) {
c.mu.Lock()
if c.option.Sticky && c.stickyRPCClient.IsClosing() || c.stickyRPCClient.IsShutdown() {
c.stickyRPCClient = nil
}

if c.option.Sticky && c.stickyRPCClient != nil {
c.mu.Unlock()
return c.stickyK, c.stickyRPCClient, nil
Expand Down

0 comments on commit b0e1cff

Please sign in to comment.