From 4ecc84bdde02401a02cb29d38290b6aec4d75511 Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Wed, 7 Oct 2020 14:40:15 +0200 Subject: [PATCH] parallelized ix_public_peering:* redis key loading --- inventory_provider/routes/classifier.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py index a9e5e211..177f9312 100644 --- a/inventory_provider/routes/classifier.py +++ b/inventory_provider/routes/classifier.py @@ -244,10 +244,12 @@ def ix_peering_info(peer_info): r = common.get_current_redis() - for k in r.keys('ix_public_peer:*'): - other = r.get(k.decode('utf-8')).decode('utf-8') - other = json.loads(other) + for doc in common.load_json_docs( + config_params=current_app.config['INVENTORY_PROVIDER_CONFIG'], + key_pattern='ix_public_peer:*', + num_threads=10): + other = doc['value'] if other['router'] == peer_info['router']: result['router'].append(other['name']) -- GitLab