diff options
Diffstat (limited to 'plugin/erratic')
-rw-r--r-- | plugin/erratic/README.md | 4 | ||||
-rw-r--r-- | plugin/erratic/ready.go | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/plugin/erratic/README.md b/plugin/erratic/README.md index 62625c1d0..a731bed0f 100644 --- a/plugin/erratic/README.md +++ b/plugin/erratic/README.md @@ -37,6 +37,10 @@ In case of a zone transfer and truncate the final SOA record *isn't* added to th This plugin implements dynamic health checking. For every dropped query it turns unhealthy. +## Ready + +This plugin reports readiness to the ready plugin. + ## Examples ~~~ corefile diff --git a/plugin/erratic/ready.go b/plugin/erratic/ready.go new file mode 100644 index 000000000..d5f18a6d5 --- /dev/null +++ b/plugin/erratic/ready.go @@ -0,0 +1,13 @@ +package erratic + +import "sync/atomic" + +// Ready returns true if the number of received queries is in the range [3, 5). All other values return false. +// To aid in testing we want to this flip between ready and not ready. +func (e *Erratic) Ready() bool { + q := atomic.LoadUint64(&e.q) + if q >= 3 && q < 5 { + return true + } + return false +} |