routertools: Set rx/tx to zero if router gets offline
This has to be done BEFORE the status is set, since otherwise the selector won't work anymore. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
9e990bc98a
commit
0ce3fa5c2f
|
@ -330,6 +330,13 @@ def detect_offline_routers(mysql):
|
|||
VALUES (%s, %s, 'offline', '')
|
||||
""",rdata)
|
||||
|
||||
mysql.execute("""
|
||||
UPDATE router_netif AS n
|
||||
INNER JOIN router AS r ON r.id = n.router
|
||||
SET n.rx = 0, n.tx = 0
|
||||
WHERE r.last_contact < %s AND r.status <> 'offline' AND r.status <> 'orphaned'
|
||||
""",(threshold,))
|
||||
# Online to Offline has to be updated after other queries!
|
||||
mysql.execute("""
|
||||
UPDATE router
|
||||
SET status = 'offline', clients = 0
|
||||
|
|
Loading…
Reference in New Issue