Fixed redis not using config variable

This commit is contained in:
Pünkösd Marcell 2020-04-22 01:20:24 +02:00
parent d0d6267c74
commit fdac9446af

5
app.py
View File

@ -26,7 +26,7 @@ def main():
logging.basicConfig(filename='', level=logging.DEBUG)
# connect to redis
r = redis.Redis(host='localhost', port=6379, db=0)
r = redis.from_url(os.get('REDIS_URL', "redis://localhost:6379/0"))
# set initial consumer addresses
ip_list = os.environ['INITIAL_SERVERS'].split(',')
@ -91,7 +91,8 @@ def main():
continue
try:
response = requests.post(f"http://{ip}/ip", json={'uuid': os.environ['LOCAL_UUID'], 'ip': current_ip})
response = requests.post(f"http://{ip}/ip",
json={'uuid': os.environ['LOCAL_UUID'], 'ip': current_ip})
logging.debug(f"Pushed update to {key.decode('utf-8')} at {ip}. Response: {response.status_code}")
except requests.exceptions.ConnectionError as e:
logging.warning(f"Could not push update to {key.decode('utf-8')}: {str(e)}")