remove unecessary mutex usage in healthchecks
This commit is contained in:
parent
5140bbe99a
commit
c134dcd6fe
1 changed files with 0 additions and 3 deletions
|
@ -49,7 +49,6 @@ type BackendHealthCheck struct {
|
||||||
|
|
||||||
//HealthCheck struct
|
//HealthCheck struct
|
||||||
type HealthCheck struct {
|
type HealthCheck struct {
|
||||||
mutex sync.Mutex
|
|
||||||
Backends map[string]*BackendHealthCheck
|
Backends map[string]*BackendHealthCheck
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
}
|
}
|
||||||
|
@ -78,14 +77,12 @@ func NewBackendHealthCheck(options Options, backendName string) *BackendHealthCh
|
||||||
|
|
||||||
//SetBackendsConfiguration set backends configuration
|
//SetBackendsConfiguration set backends configuration
|
||||||
func (hc *HealthCheck) SetBackendsConfiguration(parentCtx context.Context, backends map[string]*BackendHealthCheck) {
|
func (hc *HealthCheck) SetBackendsConfiguration(parentCtx context.Context, backends map[string]*BackendHealthCheck) {
|
||||||
hc.mutex.Lock()
|
|
||||||
hc.Backends = backends
|
hc.Backends = backends
|
||||||
if hc.cancel != nil {
|
if hc.cancel != nil {
|
||||||
hc.cancel()
|
hc.cancel()
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithCancel(parentCtx)
|
ctx, cancel := context.WithCancel(parentCtx)
|
||||||
hc.cancel = cancel
|
hc.cancel = cancel
|
||||||
hc.mutex.Unlock()
|
|
||||||
|
|
||||||
for _, backend := range backends {
|
for _, backend := range backends {
|
||||||
currentBackend := backend
|
currentBackend := backend
|
||||||
|
|
Loading…
Reference in a new issue