Skip to content
Snippets Groups Projects
Commit e19d48c8 authored by Erik Reid's avatar Erik Reid
Browse files

added peer-cache cleanup

parent d393a8f2
No related branches found
No related tags found
No related merge requests found
......@@ -260,7 +260,17 @@ def clear_cached_classifier_responses(hostname):
r = get_redis(InventoryTask.config)
for k in r.keys('classifier:cache:%s:*' % hostname):
r.delete(k)
# TODO: remove peer-cache (after adding hostname to query)
# TODO: very inefficient ... but logically simplest at this point
for k in r.keys('classifier:peer-cache:*'):
value = r.get(k.decode('utf-8'))
if not value:
# deleted in another thread
continue
value = json.loads(value.decode('utf-8'))
interfaces = value.get('interfaces', [])
if hostname in [i['interface']['router'] for i in interfaces]:
r.delete(k)
def _refresh_peers(hostname, key_base, peers):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment