fix timing

This commit is contained in:
root 2016-05-21 13:11:29 +02:00
parent 54e54f8256
commit 9c66688e64
1 changed files with 2 additions and 2 deletions

View File

@ -108,7 +108,7 @@ func (nodes *Nodes) Update(nodeID string, res *data.ResponseData) {
// Periodically saves the cached DB to json file // Periodically saves the cached DB to json file
func (nodes *Nodes) worker() { func (nodes *Nodes) worker() {
c := time.Tick(time.Second * 5) c := time.Tick(time.Second * time.Duration(nodes.config.Nodes.SaveInterval))
for range c { for range c {
log.Println("saving", len(nodes.List), "nodes") log.Println("saving", len(nodes.List), "nodes")
@ -117,7 +117,7 @@ func (nodes *Nodes) worker() {
// set node as offline (without statistics) // set node as offline (without statistics)
for _,node := range nodes.List { for _,node := range nodes.List {
if node.Statistics != nil && node.Lastseen.Unix()+int64(5*nodes.config.Respondd.CollectInterval) < nodes.Timestamp.Unix() { if node.Statistics != nil && node.Lastseen.Unix()+int64(1000*nodes.config.Respondd.CollectInterval) < nodes.Timestamp.Unix() {
// node.Statistics.Clients = data.Clients{Wifi: 0, Wifi24: 0, Wifi5: 0, Total: 0} // node.Statistics.Clients = data.Clients{Wifi: 0, Wifi24: 0, Wifi5: 0, Total: 0}
// node.Statistics = &MeshviewerStatistics{ // node.Statistics = &MeshviewerStatistics{
node.Statistics = &data.Statistics{ node.Statistics = &data.Statistics{