From 39a50573306aba7c5e1301da9605a8a5bd514eba Mon Sep 17 00:00:00 2001 From: Tanghui Lin Date: Wed, 10 Jul 2019 15:50:02 +0800 Subject: [PATCH] fix protect mode --- discovery/discovery.go | 3 ++- discovery/syncup.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/discovery/discovery.go b/discovery/discovery.go index c77d35b..515c504 100644 --- a/discovery/discovery.go +++ b/discovery/discovery.go @@ -36,6 +36,7 @@ func New(c *conf.Config) (d *Discovery, cancel context.CancelFunc) { } func (d *Discovery) exitProtect() { - time.Sleep(time.Second * 90) + // exist protect mode after two renew cycle + time.Sleep(time.Second * 60) d.protected = false } diff --git a/discovery/syncup.go b/discovery/syncup.go index b44808b..5c5fbb8 100644 --- a/discovery/syncup.go +++ b/discovery/syncup.go @@ -45,6 +45,8 @@ func (d *Discovery) syncUp() { log.Error("service syncup from(%s) failed ", uri) continue } + // sync success from other node,exit protected mode + d.protected = false for _, is := range res.Data { for _, i := range is { _ = d.registry.Register(i, i.LatestTimestamp)