middleware/proxy: Make Unhealthy a pointer (#615)
Pointer updates are atomic so drop the sync.RWMutex as it is not needed
anymore. This also fixes the race introduced with dfc71df
(although I
believe this is the first time we properly tested that code path).
This commit is contained in:
parent
ef4fa66e67
commit
acbf522ceb
6 changed files with 28 additions and 24 deletions
|
@ -218,11 +218,11 @@ func newUpstream(hosts []string, old *staticUpstream) Upstream {
|
|||
Conns: 0,
|
||||
Fails: 0,
|
||||
FailTimeout: upstream.FailTimeout,
|
||||
Unhealthy: false,
|
||||
Unhealthy: newBool(),
|
||||
|
||||
CheckDown: func(upstream *staticUpstream) UpstreamHostDownFunc {
|
||||
return func(uh *UpstreamHost) bool {
|
||||
if uh.Unhealthy {
|
||||
if *uh.Unhealthy {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue