mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
Fix health race (#645)
* Revert "middleware/proxy: Make Unhealthy a pointer (#615)"
This reverts commit acbf522ceb.
* middleware/proxy: add proper locking
This add the proper locking around `Unhealthy`.
This commit is contained in:
@@ -38,10 +38,10 @@ func NewLookupWithOption(hosts []string, opts Options) Proxy {
|
||||
Fails: 0,
|
||||
FailTimeout: upstream.FailTimeout,
|
||||
|
||||
Unhealthy: newBool(),
|
||||
Unhealthy: false,
|
||||
CheckDown: func(upstream *staticUpstream) UpstreamHostDownFunc {
|
||||
return func(uh *UpstreamHost) bool {
|
||||
if *uh.Unhealthy {
|
||||
if uh.Unhealthy {
|
||||
return true
|
||||
}
|
||||
fails := atomic.LoadInt32(&uh.Fails)
|
||||
|
||||
Reference in New Issue
Block a user