Request for bookmarks in RetryWatcher

This commit is contained in:
wojtekt 2020-05-06 19:37:57 +02:00
parent 0a6c826d3e
commit 7a65760f6e

View File

@ -102,6 +102,7 @@ func (rw *RetryWatcher) send(event watch.Event) bool {
func (rw *RetryWatcher) doReceive() (bool, time.Duration) {
watcher, err := rw.watcherClient.Watch(metav1.ListOptions{
ResourceVersion: rw.lastResourceVersion,
AllowWatchBookmarks: true,
})
// We are very unlikely to hit EOF here since we are just establishing the call,
// but it may happen that the apiserver is just shutting down (e.g. being restarted)
@ -174,11 +175,13 @@ func (rw *RetryWatcher) doReceive() (bool, time.Duration) {
return true, 0
}
// All is fine; send the event and update lastResourceVersion
// All is fine; send the non-bookmark events and update resource version.
if event.Type != watch.Bookmark {
ok = rw.send(event)
if !ok {
return true, 0
}
}
rw.lastResourceVersion = resourceVersion
continue