Fix error handling when query fails (#2255)

This commit is contained in:
Matthias Lechner 2018-10-31 18:20:43 +01:00 committed by Yong Tang
parent d42e0d4562
commit e332c8d8cb
2 changed files with 7 additions and 0 deletions

View file

@ -77,6 +77,12 @@ func (l *Loop) inc() {
l.i++
}
func (l *Loop) reset() {
l.Lock()
defer l.Unlock()
l.i = 0
}
func (l *Loop) setDisabled() {
l.Lock()
defer l.Unlock()

View file

@ -42,6 +42,7 @@ func setup(c *caddy.Controller) error {
for time.Now().Before(deadline) {
if _, err := l.exchange(addr); err != nil {
l.reset()
time.Sleep(1 * time.Second)
continue
}