mirror of
https://github.com/status-im/consul.git
synced 2025-02-26 12:25:41 +00:00
Merge pull request #884 from artushin/check-update-stagger
Check update stagger
This commit is contained in:
commit
19bf11643c
@ -208,7 +208,8 @@ func (l *localState) UpdateCheck(checkID, status, output string) {
|
|||||||
if l.config.CheckUpdateInterval > 0 && check.Status == status {
|
if l.config.CheckUpdateInterval > 0 && check.Status == status {
|
||||||
check.Output = output
|
check.Output = output
|
||||||
if _, ok := l.deferCheck[checkID]; !ok {
|
if _, ok := l.deferCheck[checkID]; !ok {
|
||||||
deferSync := time.AfterFunc(l.config.CheckUpdateInterval, func() {
|
intv := time.Duration(uint64(l.config.CheckUpdateInterval)/2) + randomStagger(l.config.CheckUpdateInterval)
|
||||||
|
deferSync := time.AfterFunc(intv, func() {
|
||||||
l.Lock()
|
l.Lock()
|
||||||
if _, ok := l.checkStatus[checkID]; ok {
|
if _, ok := l.checkStatus[checkID]; ok {
|
||||||
l.checkStatus[checkID] = syncStatus{inSync: false}
|
l.checkStatus[checkID] = syncStatus{inSync: false}
|
||||||
|
@ -601,7 +601,7 @@ func TestAgentAntiEntropy_Check_DeferSync(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAgentAntiEntory_deleteService_fails(t *testing.T) {
|
func TestAgentAntiEntropy_deleteService_fails(t *testing.T) {
|
||||||
l := new(localState)
|
l := new(localState)
|
||||||
if err := l.deleteService(""); err == nil {
|
if err := l.deleteService(""); err == nil {
|
||||||
t.Fatalf("should have failed")
|
t.Fatalf("should have failed")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user