routertools/config: Add minimum time difference for router stats

This prevents errors due to the same router being sent twice in
the same second.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2017-12-05 13:25:29 +01:00
parent 9e6e3c8dbf
commit f52af65c1c
2 changed files with 2 additions and 1 deletions

View File

@ -8,6 +8,7 @@ CONFIG = {
"orphan_threshold_days": 7,
"delete_threshold_days": 180,
"router_stat_days": 14,
"router_stat_mindiff_secs": 10,
"event_num_entries": 20,
"global_stat_days": 30,
"csv_dir": "/var/lib/ffmap/csv",

View File

@ -322,7 +322,7 @@ def set_status(mysql,router_id,status):
router_id,))
def new_router_stats(mysql, router_id, uptime, router_update):
if uptime < router_update["sys_uptime"]:
if (uptime + CONFIG["router_stat_mindiff_secs"]) < router_update["sys_uptime"]:
time = mysql.utctimestamp()
mysql.execute("""