mirror of
https://github.com/coredns/coredns.git
synced 2025-11-14 07:52:17 -05:00
plugin/ready: Reset list of readiness plugins on startup (#5492)
* reset readiness plugins list on startup Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
@@ -13,6 +13,14 @@ type list struct {
|
||||
names []string
|
||||
}
|
||||
|
||||
// Reset resets l
|
||||
func (l *list) Reset() {
|
||||
l.Lock()
|
||||
defer l.Unlock()
|
||||
l.rs = nil
|
||||
l.names = nil
|
||||
}
|
||||
|
||||
// Append adds a new readiness to l.
|
||||
func (l *list) Append(r Readiness, name string) {
|
||||
l.Lock()
|
||||
|
||||
@@ -25,6 +25,7 @@ func setup(c *caddy.Controller) error {
|
||||
c.OnRestartFailed(func() error { return uniqAddr.ForEach() })
|
||||
|
||||
c.OnStartup(func() error {
|
||||
plugins.Reset()
|
||||
for _, p := range dnsserver.GetConfig(c).Handlers() {
|
||||
if r, ok := p.(Readiness); ok {
|
||||
plugins.Append(r, p.Name())
|
||||
|
||||
Reference in New Issue
Block a user