From 2a77c552bfd8a20e9ebb068f0c4aef49af367cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kocsis=20Rich=C3=A1rd?= Date: Fri, 17 Apr 2020 16:25:51 +0200 Subject: [PATCH] Update 'app.py' --- app.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app.py b/app.py index ddf3390..55f5b80 100644 --- a/app.py +++ b/app.py @@ -76,6 +76,16 @@ def main(): logging.debug('Waiting for next turn') # wait for the next update time + + if current_ip != socket.gethostbyname(host_name): + current_ip = socket.gethostbyname(host_name) + keys = redis.keys('producer_*') + for key in keys: + ip = redis.get(key) + if not ip: + continue + response = requests.post(f"http://{ip}/ip", json={'uuid': os.environ['LOCAL_UUID'], 'ip': current_ip}) + logging.debug(response.status_code) time.sleep(30)