add a warning in case of transient error
This commit is contained in:
parent
32306467ea
commit
24316804d9
@ -165,7 +165,7 @@ func (ph *ProxyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
for containerName, mr = range containerMethodRegex {
|
for containerName, mr = range containerMethodRegex {
|
||||||
resolvedIPs, err := net.LookupIP(containerName)
|
resolvedIPs, err := net.LookupIP(containerName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Err(err).Send()
|
log.Warn().Err(err).Msg("this error may be transient due to the unavailability of one of the services")
|
||||||
}
|
}
|
||||||
for _, resolvedIP := range resolvedIPs {
|
for _, resolvedIP := range resolvedIPs {
|
||||||
if resolvedIP.Equal(ip) {
|
if resolvedIP.Equal(ip) {
|
||||||
@ -206,33 +206,6 @@ func (s serve) action(ctx context.Context, command *cli.Command) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
requests := command.StringSlice(addRequestsFlagName)
|
|
||||||
log.Info().Msgf("%d", len(requests))
|
|
||||||
if len(requests) > 0 {
|
|
||||||
clear(containerMethodRegex)
|
|
||||||
for _, request := range requests {
|
|
||||||
// An applicator is a container name/HTTP method pair e.g., nginx(GET).
|
|
||||||
// The following regex extracts this applicator and the associated URL regex.
|
|
||||||
aur := applicatorURLRegex.FindString(request)
|
|
||||||
if aur == "" {
|
|
||||||
// If we are here, it means that user set a wildcard (kinda) applicator e.g., GET,POST:URL_REGEX.
|
|
||||||
// In its extended form, this applicator can be read as follows: *(GET,POST):URL_REGEX.
|
|
||||||
methods, urlRegex, ok := strings.Cut(request, ":")
|
|
||||||
if !ok { // || methods == ""?
|
|
||||||
return errors.New("HTTP method(s) must be specified before ':'")
|
|
||||||
}
|
|
||||||
if err = registerMethodRegex("*", urlRegex, strings.Split(methods, ",")); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
applicator, urlRegex, _ := strings.Cut(aur, ":")
|
|
||||||
if err = registerMethodRegex(containerNameRegex.FindString(applicator), urlRegex, httpMethodsRegex.FindAllString(applicator, -1)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
var l net.Listener
|
var l net.Listener
|
||||||
l, err = net.Listen("tcp", ap.srvAddrPort.String())
|
l, err = net.Listen("tcp", ap.srvAddrPort.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user