mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3: wait for ConnectNotify before sending RPCs
With slow CPU, gRPC can lag behind with RPCs being sent before calling 'Up', returning 'no address available' on the first try. Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
b6b4898f6b
commit
a439095697
@ -51,6 +51,13 @@ func isWriteStopError(err error) bool {
|
||||
func (c *Client) newRetryWrapper(isStop retryStopErrFunc) retryRpcFunc {
|
||||
return func(rpcCtx context.Context, f rpcFunc) error {
|
||||
for {
|
||||
select {
|
||||
case <-c.balancer.ConnectNotify():
|
||||
case <-rpcCtx.Done():
|
||||
return rpcCtx.Err()
|
||||
case <-c.ctx.Done():
|
||||
return c.ctx.Err()
|
||||
}
|
||||
err := f(rpcCtx)
|
||||
if err == nil {
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user