api/alfredX: remove chunked MySQL commit
So far, MySQL commits were triggered for each bunch of 500 devices. However, since data is provided _per hood_, we will never receive chunks that big. Just commit once after each alfred batch. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
f5135344c3
commit
16e083d06c
|
@ -162,12 +162,8 @@ def alfred():
|
|||
|
||||
if alfred_data:
|
||||
# load router status xml data
|
||||
i = 1
|
||||
for mac, xml in alfred_data.get("64", {}).items():
|
||||
import_nodewatcher_xml(mysql, mac, xml, banned, hoodsv2, netifdict, hoodsdict, statstime)
|
||||
if (i%500 == 0):
|
||||
mysql.commit()
|
||||
i += 1
|
||||
mysql.commit()
|
||||
r.headers['X-API-STATUS'] = "ALFRED data imported"
|
||||
mysql.close()
|
||||
|
@ -215,12 +211,8 @@ def alfred2():
|
|||
|
||||
if alfred_data:
|
||||
# load router status xml data
|
||||
i = 1
|
||||
for mac, xml in alfred_data.items():
|
||||
import_nodewatcher_xml(mysql, mac, xml, banned, hoodsv2, netifdict, hoodsdict, statstime)
|
||||
if (i%500 == 0):
|
||||
mysql.commit()
|
||||
i += 1
|
||||
mysql.commit()
|
||||
r.headers['X-API-STATUS'] = "ALFRED2 data imported"
|
||||
mysql.close()
|
||||
|
|
Loading…
Reference in New Issue