Skip to content

Commit aced6b6

Browse files
committed
fix: 修复 switchServerAsync 在重连进行中导致的阻塞问题
1 parent 6792e63 commit aced6b6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

common/remote/rpc/rpc_client.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,12 @@ func (r *RpcClient) RegisterConnectionListener(listener IConnectionEventListener
407407
}
408408

409409
func (r *RpcClient) switchServerAsync(recommendServerInfo ServerInfo, onRequestFail bool) {
410-
r.reconnectionChan <- ReconnectContext{serverInfo: recommendServerInfo, onRequestFail: onRequestFail}
410+
select {
411+
case r.reconnectionChan <- ReconnectContext{serverInfo: recommendServerInfo, onRequestFail: onRequestFail}:
412+
default:
413+
logger.Warnf("reconnection already in progress, skip this request")
414+
}
415+
411416
}
412417

413418
func (r *RpcClient) reconnect(serverInfo ServerInfo, onRequestFail bool) {

0 commit comments

Comments
 (0)