Skip to content

Commit

Permalink
Fix error handling when query fails (coredns#2255)
Browse files Browse the repository at this point in the history
  • Loading branch information
matlec authored and mdgreenfield committed Mar 4, 2019
1 parent 107a194 commit 555ddea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugin/loop/loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions plugin/loop/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 555ddea

Please sign in to comment.