Periodically flush stats.json
This commit is contained in:
parent
51ec58b0ce
commit
856e26edcf
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…
Reference in New Issue