Skip to content

Commit 7a65760

Browse files
committed
Request for bookmarks in RetryWatcher
1 parent 0a6c826 commit 7a65760

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

staging/src/k8s.io/client-go/tools/watch/retrywatcher.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ func (rw *RetryWatcher) send(event watch.Event) bool {
101101
// If it is not done the second return value holds the time to wait before calling it again.
102102
func (rw *RetryWatcher) doReceive() (bool, time.Duration) {
103103
watcher, err := rw.watcherClient.Watch(metav1.ListOptions{
104-
ResourceVersion: rw.lastResourceVersion,
104+
ResourceVersion: rw.lastResourceVersion,
105+
AllowWatchBookmarks: true,
105106
})
106107
// We are very unlikely to hit EOF here since we are just establishing the call,
107108
// but it may happen that the apiserver is just shutting down (e.g. being restarted)
@@ -174,10 +175,12 @@ func (rw *RetryWatcher) doReceive() (bool, time.Duration) {
174175
return true, 0
175176
}
176177

177-
// All is fine; send the event and update lastResourceVersion
178-
ok = rw.send(event)
179-
if !ok {
180-
return true, 0
178+
// All is fine; send the non-bookmark events and update resource version.
179+
if event.Type != watch.Bookmark {
180+
ok = rw.send(event)
181+
if !ok {
182+
return true, 0
183+
}
181184
}
182185
rw.lastResourceVersion = resourceVersion
183186

0 commit comments

Comments
 (0)