Skip to content

Commit

Permalink
code clean for HealthCheckLazyDefault
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Nov 26, 2020
1 parent fc4d3ab commit 07e6b30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
12 changes: 12 additions & 0 deletions adapters/provider/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ const (
touchAfterLazyPassNum = 10
)

var (
healthCheckLazyDefault = true
)

type HealthCheckOption struct {
URL string
Interval uint
Expand Down Expand Up @@ -154,3 +158,11 @@ func NewHealthCheck(proxies []C.Proxy, url string, interval uint, lazy bool, gty
checking: false,
}
}

func HealthCheckLazyDefault() bool {
return healthCheckLazyDefault
}

func SetHealthCheckLazyDefault(newHealthCheckLazyDefault bool) {
healthCheckLazyDefault = newHealthCheckLazyDefault
}
11 changes: 1 addition & 10 deletions adapters/provider/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import (
)

var (
errVehicleType = errors.New("unsupport vehicle type")
healthCheckLazyDefault = true
errVehicleType = errors.New("unsupport vehicle type")
)

type healthCheckSchema struct {
Expand Down Expand Up @@ -62,11 +61,3 @@ func ParseProxyProvider(name string, mapping map[string]interface{}) (ProxyProvi
interval := time.Duration(uint(schema.Interval)) * time.Second
return NewProxySetProvider(name, interval, vehicle, hc), nil
}

func HealthCheckLazyDefault() bool {
return healthCheckLazyDefault
}

func SetHealthCheckLazyDefault(newHealthCheckLazyDefault bool) {
healthCheckLazyDefault = newHealthCheckLazyDefault
}

0 comments on commit 07e6b30

Please sign in to comment.