Fix error handling when query fails (#2255)
This commit is contained in:
parent
d42e0d4562
commit
e332c8d8cb
2 changed files with 7 additions and 0 deletions
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue