mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-03-14 22:48:35 +03:00
Periodically flush stats.json
This commit is contained in:
parent
51ec58b0ce
commit
856e26edcf
1 changed files with 11 additions and 0 deletions
11
app.go
11
app.go
|
@ -9,6 +9,7 @@ import (
|
|||
"os/signal"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gobuffalo/packr"
|
||||
)
|
||||
|
@ -132,6 +133,16 @@ func main() {
|
|||
os.Exit(1)
|
||||
}()
|
||||
|
||||
go func() {
|
||||
for range time.Tick(time.Hour * 24) {
|
||||
err := writeStats()
|
||||
if err != nil {
|
||||
log.Printf("Couldn't write stats: %s", err)
|
||||
// try later on next iteration, don't abort
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
|
||||
|
||||
runStatsCollectors()
|
||||
|
|
Loading…
Add table
Reference in a new issue