only log error if its plus 3
This commit is contained in:
parent
39c24baca9
commit
f2ac73eae5
@ -255,6 +255,9 @@ func (c *registrySelector) run(name string) {
|
||||
c.Unlock()
|
||||
}()
|
||||
|
||||
// error counter
|
||||
var cerr int
|
||||
|
||||
for {
|
||||
// exit early if already dead
|
||||
if c.quit() {
|
||||
@ -265,11 +268,16 @@ func (c *registrySelector) run(name string) {
|
||||
w, err := c.so.Registry.Watch(
|
||||
registry.WatchService(name),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
if c.quit() {
|
||||
return
|
||||
}
|
||||
cerr++
|
||||
if cerr > 3 {
|
||||
log.Log(err)
|
||||
cerr = 0
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
@ -279,9 +287,16 @@ func (c *registrySelector) run(name string) {
|
||||
if c.quit() {
|
||||
return
|
||||
}
|
||||
cerr++
|
||||
if cerr > 3 {
|
||||
cerr = 0
|
||||
log.Log(err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// reset err counter
|
||||
cerr = 0
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user