From 16e083d06c2da2f7a5cba43d8f25bb89855a250e Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Tue, 24 Nov 2020 13:51:17 +0100 Subject: [PATCH] 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 --- ffmap/web/api.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ffmap/web/api.py b/ffmap/web/api.py index 0c4c23d..6cc1945 100755 --- a/ffmap/web/api.py +++ b/ffmap/web/api.py @@ -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()