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)