mirror of https://github.com/status-im/consul.git
Merge pull request #2621 from alicebob/devwatch
reset watch's lastIndex on error
This commit is contained in:
commit
5f9776ac89
|
@ -57,6 +57,7 @@ OUTER:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Perform an exponential backoff
|
// Perform an exponential backoff
|
||||||
failures++
|
failures++
|
||||||
|
p.lastIndex = 0
|
||||||
retry := retryInterval * time.Duration(failures*failures)
|
retry := retryInterval * time.Duration(failures*failures)
|
||||||
if retry > maxBackoffTime {
|
if retry > maxBackoffTime {
|
||||||
retry = maxBackoffTime
|
retry = maxBackoffTime
|
||||||
|
@ -85,6 +86,9 @@ OUTER:
|
||||||
if oldIndex != 0 && reflect.DeepEqual(p.lastResult, result) {
|
if oldIndex != 0 && reflect.DeepEqual(p.lastResult, result) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if p.lastIndex < oldIndex {
|
||||||
|
p.lastIndex = 0
|
||||||
|
}
|
||||||
|
|
||||||
// Handle the updated result
|
// Handle the updated result
|
||||||
p.lastResult = result
|
p.lastResult = result
|
||||||
|
|
Loading…
Reference in New Issue