mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3: add TODO for watch retry
Later we can do: ```diff +// RetryWatchClient implements a WatchClient. +func RetryWatchClient(c *Client) pb.WatchClient { + readRetry := c.newRetryWrapper(isReadStopError) + wc := pb.NewWatchClient(c.conn) + return &retryWatchClient{wc, readRetry} +} + +type retryWatchClient struct { + pb.WatchClient + readRetry retryRPCFunc +} + +func (rwc *retryWatchClient) Watch(ctx context.Context, opts ...grpc.CallOption) (stream pb.Watch_WatchClient, err error) { + err = rwc.readRetry(ctx, func(rctx context.Context) error { + stream, err = rwc.WatchClient.Watch(rctx, opts...) + return err + }) + return stream, err +} - return NewWatchFromWatchClient(pb.NewWatchClient(c.conn)) + return NewWatchFromWatchClient(RetryWatchClient(c)) ``` Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
This commit is contained in:
parent
141170c1d4
commit
1fa60c9882
@ -762,6 +762,8 @@ func (w *watchGrpcStream) joinSubstreams() {
|
||||
}
|
||||
|
||||
// openWatchClient retries opening a watch client until success or halt.
|
||||
// manually retry in case "ws==nil && err==nil"
|
||||
// TODO: remove FailFast=false
|
||||
func (w *watchGrpcStream) openWatchClient() (ws pb.Watch_WatchClient, err error) {
|
||||
for {
|
||||
select {
|
||||
|
Loading…
x
Reference in New Issue
Block a user