Fixed redis not using config variable
This commit is contained in:
parent
d0d6267c74
commit
fdac9446af
5
app.py
5
app.py
@ -26,7 +26,7 @@ def main():
|
|||||||
logging.basicConfig(filename='', level=logging.DEBUG)
|
logging.basicConfig(filename='', level=logging.DEBUG)
|
||||||
|
|
||||||
# connect to redis
|
# 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
|
# set initial consumer addresses
|
||||||
ip_list = os.environ['INITIAL_SERVERS'].split(',')
|
ip_list = os.environ['INITIAL_SERVERS'].split(',')
|
||||||
@ -91,7 +91,8 @@ def main():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
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}")
|
logging.debug(f"Pushed update to {key.decode('utf-8')} at {ip}. Response: {response.status_code}")
|
||||||
except requests.exceptions.ConnectionError as e:
|
except requests.exceptions.ConnectionError as e:
|
||||||
logging.warning(f"Could not push update to {key.decode('utf-8')}: {str(e)}")
|
logging.warning(f"Could not push update to {key.decode('utf-8')}: {str(e)}")
|
||||||
|
Reference in New Issue
Block a user