routertools: Set rx/tx to zero if router gets offline

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2018-01-16 00:16:27 +01:00
parent 0571fab729
commit 1db9633f13
1 changed files with 6 additions and 0 deletions

View File

@ -335,6 +335,12 @@ def detect_offline_routers(mysql):
SET status = 'offline', clients = 0
WHERE last_contact < %s AND status <> 'offline' AND status <> 'orphaned'
""",(threshold,))
mysql.execute("""
UPDATE router_netif AS n
INNER JOIN router ON router.id = router_netif.router
SET n.rx = 0, n.tx = 0
WHERE last_contact < %s AND status <> 'offline' AND status <> 'orphaned'
""",(threshold,))
mysql.commit()
def detect_orphaned_routers(mysql):