From aba1ad87d47efaa7dc466168b4150e178201472c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Mon, 26 Nov 2018 14:57:58 +0100 Subject: [PATCH] chg: Cleanup the monitoring output from IPASN History --- bgpranking/monitor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bgpranking/monitor.py b/bgpranking/monitor.py index c6e7c79..fd144eb 100644 --- a/bgpranking/monitor.py +++ b/bgpranking/monitor.py @@ -17,6 +17,11 @@ class Monitor(): def get_values(self): ips_in_intake = self.intake.scard('intake') ready_to_insert = self.sanitize.scard('to_insert') + ipasn_meta = self.ipasn.meta() + if len(ipasn_meta['cached_dates']['caida']['v4']['cached']) > 15: + ipasn_meta['cached_dates']['caida']['v4']['cached'] = 'Too many entries' + if len(ipasn_meta['cached_dates']['caida']['v6']['cached']) > 15: + ipasn_meta['cached_dates']['caida']['v6']['cached'] = 'Too many entries' return json.dumps({'Non-parsed IPs': ips_in_intake, 'Parsed IPs': ready_to_insert, - 'IPASN History': self.ipasn.meta(), 'running': self.cache.hgetall('running')}, + 'running': self.cache.hgetall('running'), 'IPASN History': ipasn_meta}, indent=2)