Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INLONG-11694][SDK] Fix infinite loop in Golang SDK #11697

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ func (p *connPool) put(conn gnet.Conn, err error, isNewConn bool) {
if p.expired(conn) {
p.log.Debug("connection expired, close it, addr:", addr, ", err:", err)
CloseConn(conn, defaultConnCloseDelay)
// 关闭连接后,可用连接数变少,addr对应的节点的连接数可能也不均衡,尽管会递归调用当前函数,仍在这里追加创建新的连接
// when conn is closed, available connections is less than before, the number of connections for the endpoint may not be balanced,
// although it may be called recursively, we still append a new connection here
_ = p.appendNewConn(addr)
return
}
Expand Down Expand Up @@ -571,6 +572,8 @@ func (p *connPool) recoverAndRebalance() {
default:
time.Sleep(time.Second)
}
} else {
time.Sleep(time.Second)
}
}
}
Expand Down