mirror of
https://github.com/coredns/coredns.git
synced 2025-08-11 08:47:00 +02:00
Implement health.Healther in erratic and kubernetes plugin. The kubernetes' healtcheck is only performed on startup - i.e. turn healthy after the initial loading. Erratic follow the drop count: every query%drop turns the healthcheck unhealthy. Fixes: #985
15 lines
227 B
Go
15 lines
227 B
Go
package erratic
|
|
|
|
import (
|
|
"sync/atomic"
|
|
)
|
|
|
|
// Health implements the health.Healther interface.
|
|
func (e *Erratic) Health() bool {
|
|
q := atomic.LoadUint64(&e.q)
|
|
if e.drop > 0 && q%e.drop == 0 {
|
|
return false
|
|
}
|
|
return true
|
|
}
|