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"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gobuffalo/packr"
|
"github.com/gobuffalo/packr"
|
||||||
)
|
)
|
||||||
|
@ -132,6 +133,16 @@ func main() {
|
||||||
os.Exit(1)
|
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))
|
address := net.JoinHostPort(config.BindHost, strconv.Itoa(config.BindPort))
|
||||||
|
|
||||||
runStatsCollectors()
|
runStatsCollectors()
|
||||||
|
|
Loading…
Reference in New Issue