mirror of https://github.com/hashicorp/consul
agent: Adding random stagger to anti-entropy. Fixes #72.
parent
02fa6e9d96
commit
903789aee4
|
@ -11,7 +11,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
syncRetryIntv = 30 * time.Second
|
syncStaggerIntv = 3 * time.Second
|
||||||
|
syncRetryIntv = 15 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
// syncStatus is used to represent the difference between
|
// syncStatus is used to represent the difference between
|
||||||
|
@ -223,7 +224,13 @@ SYNC:
|
||||||
l.logger.Printf("[ERR] agent: failed to sync remote state: %v", err)
|
l.logger.Printf("[ERR] agent: failed to sync remote state: %v", err)
|
||||||
select {
|
select {
|
||||||
case <-l.consulCh:
|
case <-l.consulCh:
|
||||||
case <-time.After(aeScale(syncRetryIntv, len(l.iface.LANMembers()))):
|
// Stagger the retry on leader election, avoid a thundering heard
|
||||||
|
select {
|
||||||
|
case <-time.After(randomStagger(aeScale(syncStaggerIntv, len(l.iface.LANMembers())))):
|
||||||
|
case <-shutdownCh:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
case <-time.After(randomStagger(aeScale(syncRetryIntv, len(l.iface.LANMembers())))):
|
||||||
case <-shutdownCh:
|
case <-shutdownCh:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue