Closed wolfbolin closed 4 months ago
This is not a problem, there is no scenario that cannot be closed. c.Ping method has a timeout period.
select的操作不合理,ctx.Done()和t.C可能同时满足,case之间是没有顺序的。同时,接收到Ticker的信号后的处理不应该阻塞后续信号的接收。这不满足对于golang的最佳实践。
if ticker.C is executed first, in the next loop, ctx.Done will be executed quickly, which is not a problem. if you have a better optimization solution, welcome to submit PR.
Same usage error #100
https://github.com/openGemini/opengemini-client-go/blob/49423902a3ca16ac35fa57265f70914d470a964d/opengemini/servers_check.go#L16-L46
c.Ping()函数因网络阻塞时 => 协程无法退出 => checkUpOrDown函数无法停止 => c.endpointsCheck函数将长时间阻塞 => 导致无法接收context.Context停止的信号。