api/alfred: Disable router_rate_limit_list

With router_rate_limit_list, routers were not processed if the
time difference between calls was less than 5 minutes for the
same MAC address.

While this is generally not bad, there are some drawbacks:
- Not having been aware of this fact, we have established other
  mechanisms to dilute data density, which might have interfered
- With KeyXchangeV2, two gateways will send data with less than
  5 min. difference. As gateways are not connected, we know that
  we alternately receive newer and older data. With
  router_rate_limit_list, some of this data has been discarded
  before its "age" was evaluated. This caused an unwanted additional
  dilution of data which might have caused "offline" routers not
  being actually offline (for a short period)
- With KeyXchangeV1, if the second call was a little earlier, the
  a big share of the data would not be "new enough" and just be
  discarded
- With KeyXchangeV1, the same would happen for the order of records
  varying between alfred calls, were some records would have more and
  some less than 5 minutes time difference

To get rid of these issues, we remove router_rate_limit_list and
test whether the newer measures to dilute data are effective.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2018-03-15 16:35:59 +01:00
parent c77e04ee7f
commit a57d459c77
1 changed files with 6 additions and 6 deletions

View File

@ -16,7 +16,7 @@ import time
from bson import SON
from contextlib import suppress
router_rate_limit_list = {}
#router_rate_limit_list = {}
def delete_router(mysql,dbid):
mysql.execute("DELETE FROM router WHERE id = %s",(dbid,))
@ -41,12 +41,12 @@ def ban_router(mysql,dbid):
mysql.commit()
def import_nodewatcher_xml(mysql, mac, xml, banned, netifdict, statstime):
global router_rate_limit_list
#global router_rate_limit_list
if mac in router_rate_limit_list:
if (statstime - router_rate_limit_list[mac]) < datetime.timedelta(minutes=5):
return
router_rate_limit_list[mac] = statstime
#if mac in router_rate_limit_list:
# if (statstime - router_rate_limit_list[mac]) < datetime.timedelta(minutes=5):
# return
#router_rate_limit_list[mac] = statstime
# The following values should stay available after router reset
keepvalues = ['lat','lng','description','position_comment','contact']