diff --git a/consumer_api/views/consumers_view.py b/consumer_api/views/consumers_view.py index 0582bc4..ead5288 100644 --- a/consumer_api/views/consumers_view.py +++ b/consumer_api/views/consumers_view.py @@ -8,6 +8,13 @@ from flask_classful import FlaskView class ConsumersView(FlaskView): def get(self): - consumer_list = json.loads((redis_client.get("consumer_list") or b"{}").decode('utf-8')) - current_app.logger.warning(jsonify([v['ip'] for k, v in consumer_list.items()])) - return jsonify([v['ip'] for k, v in consumer_list.items()]) + + keys = redis_client.keys('producer_*') + + list_of_customer_ips = [] + + for key in keys: + info = json.loads((redis_client.get(key) or b"{}").decode('utf-8')) + list_of_customer_ips.append(info['ip']) + + return jsonify(list_of_customer_ips)