mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-22 04:55:33 +03:00
coredns plugin -- don't reload from querylog on SIGUSR, we already have it in memory
This commit is contained in:
parent
4ecb84f9ad
commit
ea1125f57d
1 changed files with 6 additions and 0 deletions
|
@ -36,6 +36,7 @@ func (top *hourTop) init() {
|
|||
|
||||
type dayTop struct {
|
||||
hours []*hourTop
|
||||
loaded bool
|
||||
sync.RWMutex // write -- rotating hourTop, read -- anything else
|
||||
}
|
||||
|
||||
|
@ -209,6 +210,9 @@ func (r *dayTop) addEntry(entry *logEntry, now time.Time) error {
|
|||
func loadTopFromFiles() error {
|
||||
now := time.Now()
|
||||
runningTop.RLock()
|
||||
if runningTop.loaded {
|
||||
return nil
|
||||
}
|
||||
defer runningTop.RUnlock()
|
||||
onEntry := func(entry *logEntry) error {
|
||||
err := runningTop.addEntry(entry, now)
|
||||
|
@ -226,6 +230,8 @@ func loadTopFromFiles() error {
|
|||
return err
|
||||
}
|
||||
|
||||
runningTop.loaded = true
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue