Merge pull request #2621 from alicebob/devwatch

reset watch's lastIndex on error
This commit is contained in:
James Phillips 2017-06-02 09:06:02 -07:00 committed by GitHub
commit d8c21afa35
1 changed files with 4 additions and 0 deletions

View File

@ -57,6 +57,7 @@ OUTER:
if err != nil {
// Perform an exponential backoff
failures++
p.lastIndex = 0
retry := retryInterval * time.Duration(failures*failures)
if retry > maxBackoffTime {
retry = maxBackoffTime
@ -85,6 +86,9 @@ OUTER:
if oldIndex != 0 && reflect.DeepEqual(p.lastResult, result) {
continue
}
if p.lastIndex < oldIndex {
p.lastIndex = 0
}
// Handle the updated result
p.lastResult = result