|
|
|
@ -2,7 +2,6 @@ package api
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"strings"
|
|
|
|
|
"sync"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
@ -362,15 +361,11 @@ WAIT:
|
|
|
|
|
RETRY:
|
|
|
|
|
pair, meta, err := kv.Get(l.opts.Key, opts)
|
|
|
|
|
if err != nil {
|
|
|
|
|
// TODO (slackpad) - Make a real error type here instead of using
|
|
|
|
|
// a string check.
|
|
|
|
|
const serverError = "Unexpected response code: 500"
|
|
|
|
|
|
|
|
|
|
// If configured we can try to ride out a brief Consul unavailability
|
|
|
|
|
// by doing retries. Note that we have to attempt the retry in a non-
|
|
|
|
|
// blocking fashion so that we have a clean place to reset the retry
|
|
|
|
|
// counter if service is restored.
|
|
|
|
|
if retries > 0 && strings.Contains(err.Error(), serverError) {
|
|
|
|
|
if retries > 0 && IsServerError(err) {
|
|
|
|
|
time.Sleep(l.opts.MonitorRetryTime)
|
|
|
|
|
retries--
|
|
|
|
|
opts.WaitIndex = 0
|
|
|
|
|