reset watch's lastIndex on error

When a -dev agent is restarted it'll have a clean state, including a
reset index. A watch() will reconnect after a restart, but it won't
notice that the index counter has reset and it will keep waiting until
we reached the old index again, which is wrong. Resetting the index will
prevent that and makes watch work for -dev agents.
This commit is contained in:
Harmen 2016-12-29 21:58:46 +01:00
parent 6f03545082
commit 0d550ff4b8
1 changed files with 1 additions and 0 deletions

View File

@ -57,6 +57,7 @@ OUTER:
if err != nil {
// Perform an exponential backoff
failures++
p.lastIndex = 1
retry := retryInterval * time.Duration(failures*failures)
if retry > maxBackoffTime {
retry = maxBackoffTime