fix fail marker
This commit is contained in:
parent
44acdc9215
commit
397a13bcdb
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -155,6 +154,10 @@ func buildConfigFromCmd(services, nodes stringList) (*config.Config, error) {
|
|||||||
cfg.Services = append(cfg.Services, service)
|
cfg.Services = append(cfg.Services, service)
|
||||||
|
|
||||||
md := metadata.MapMetadata(service.Handler.Metadata)
|
md := metadata.MapMetadata(service.Handler.Metadata)
|
||||||
|
if v := metadata.GetInt(md, "retries"); v > 0 {
|
||||||
|
service.Handler.Retries = v
|
||||||
|
md.Del("retries")
|
||||||
|
}
|
||||||
if v := metadata.GetString(md, "bypass"); v != "" {
|
if v := metadata.GetString(md, "bypass"); v != "" {
|
||||||
bypassCfg := &config.BypassConfig{
|
bypassCfg := &config.BypassConfig{
|
||||||
Name: fmt.Sprintf("bypass-%d", len(cfg.Bypasses)),
|
Name: fmt.Sprintf("bypass-%d", len(cfg.Bypasses)),
|
||||||
@ -480,24 +483,3 @@ func parseSelector(md metadata.MapMetadata) *config.SelectorConfig {
|
|||||||
FailTimeout: failTimeout,
|
FailTimeout: failTimeout,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseIP(s, port string) (ips []string) {
|
|
||||||
if s == "" {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if port == "" {
|
|
||||||
port = "8080"
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, v := range strings.Split(s, ",") {
|
|
||||||
if v == "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if _, _, err := net.SplitHostPort(v); err != nil {
|
|
||||||
v = net.JoinHostPort(v, port) // assume the port is missing
|
|
||||||
}
|
|
||||||
ips = append(ips, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
@ -68,7 +68,7 @@ func (m *FailMarker) FailTime() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return atomic.LoadInt64(&m.failCount)
|
return atomic.LoadInt64(&m.failTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *FailMarker) FailCount() int64 {
|
func (m *FailMarker) FailCount() int64 {
|
||||||
|
Loading…
Reference in New Issue
Block a user