updated app.py
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import os
|
||||
import logging
|
||||
import requests
|
||||
import requests.exceptions
|
||||
from redis_super_storage import RedisSuperStorage
|
||||
|
||||
|
||||
@@ -16,7 +17,7 @@ class ProducerCommunicator:
|
||||
for key, ip in self._redis_store.get_producer_list().items():
|
||||
|
||||
try:
|
||||
response = requests.post(
|
||||
response = self._session.post(
|
||||
f"http://{ip}/ip",
|
||||
json={'uuid': os.environ['LOCAL_UUID'], 'ip': newip},
|
||||
timeout=5
|
||||
@@ -35,7 +36,7 @@ class ConsumerCommunicator:
|
||||
def targeted_snyc(self, ip: str):
|
||||
try:
|
||||
# request synchronization
|
||||
response = requests.post(f"http://{ip}/sync", json={'uuid': os.environ['LOCAL_UUID']}, timeout=5)
|
||||
response = self._session.post(f"http://{ip}/sync", json={'uuid': os.environ['LOCAL_UUID']}, timeout=5)
|
||||
|
||||
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout) as e:
|
||||
logging.error(f"Error while syncing to {ip}: {str(e)}")
|
||||
|
||||
Reference in New Issue
Block a user