From 5a884effa96e0c797c5afb52667a4fe8f36d81d5 Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Wed, 15 Jan 2020 20:34:32 +0100
Subject: [PATCH] unique-ify locations in peer-info response

---
 inventory_provider/routes/classifier.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py
index a9fd126e..1eff7e84 100644
--- a/inventory_provider/routes/classifier.py
+++ b/inventory_provider/routes/classifier.py
@@ -301,7 +301,6 @@ def peer_info(address):
     cache_key = f'classifier-cache:peer:{address}'
 
     result = r.get(cache_key)
-    result = None
     if result:
         result = result.decode('utf-8')
     else:
@@ -335,6 +334,7 @@ def peer_info(address):
                 l = [_location_from_service_dict(s) for s in i['services']]
                 result['locations'] += l
 
+        result['locations'] = _unique_dicts_from_list(result['locations'])
         result = json.dumps(result)
         # cache this data for the next call
         r.set(cache_key, result.encode('utf-8'))
-- 
GitLab