Update 'app.py'
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kocsis Richárd 2020-04-17 16:25:51 +02:00
parent a1ca3285ab
commit 2a77c552bf

10
app.py
View File

@ -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)