aboutsummaryrefslogtreecommitdiff
path: root/plugin/file/zone.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/file/zone.go')
-rw-r--r--plugin/file/zone.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugin/file/zone.go b/plugin/file/zone.go
index 5aa72175f..ecfd74faa 100644
--- a/plugin/file/zone.go
+++ b/plugin/file/zone.go
@@ -6,6 +6,7 @@ import (
"path"
"strings"
"sync"
+ "time"
"github.com/coredns/coredns/plugin/file/tree"
"github.com/coredns/coredns/plugin/pkg/upstream"
@@ -27,7 +28,8 @@ type Zone struct {
TransferFrom []string
Expired *bool
- NoReload bool
+ ReloadInterval time.Duration
+ LastReloaded time.Time
reloadMu sync.RWMutex
reloadShutdown chan bool
Upstream upstream.Upstream // Upstream for looking up names during the resolution process
@@ -50,6 +52,7 @@ func NewZone(name, file string) *Zone {
Tree: &tree.Tree{},
Expired: new(bool),
reloadShutdown: make(chan bool),
+ LastReloaded: time.Now(),
}
*z.Expired = false
@@ -161,7 +164,7 @@ func (z *Zone) TransferAllowed(state request.Request) bool {
// All returns all records from the zone, the first record will be the SOA record,
// otionally followed by all RRSIG(SOA)s.
func (z *Zone) All() []dns.RR {
- if !z.NoReload {
+ if z.ReloadInterval > 0 {
z.reloadMu.RLock()
defer z.reloadMu.RUnlock()
}