remove unecessary mutex usage in healthchecks

This commit is contained in:
Marco Jantke 2018-01-22 11:32:02 +01:00 committed by Traefiker
parent 5140bbe99a
commit c134dcd6fe

View file

@ -49,7 +49,6 @@ type BackendHealthCheck struct {
//HealthCheck struct
type HealthCheck struct {
mutex sync.Mutex
Backends map[string]*BackendHealthCheck
cancel context.CancelFunc
}
@ -78,14 +77,12 @@ func NewBackendHealthCheck(options Options, backendName string) *BackendHealthCh
//SetBackendsConfiguration set backends configuration
func (hc *HealthCheck) SetBackendsConfiguration(parentCtx context.Context, backends map[string]*BackendHealthCheck) {
hc.mutex.Lock()
hc.Backends = backends
if hc.cancel != nil {
hc.cancel()
}
ctx, cancel := context.WithCancel(parentCtx)
hc.cancel = cancel
hc.mutex.Unlock()
for _, backend := range backends {
currentBackend := backend