arangodb/python-arango

Support for Fallback hosts while creating connections

Closed this issue · 1 comments

There is an option to pass multiple hosts while creating AragoClient.
For example,
`client_hosts = ["http://127.0.0.1:8529", "http://localhost:9539"]
http_client = DefaultHTTPClient()
client2 = ArangoClient(
hosts=client_hosts,
host_resolver="random",
http_client=http_client,
serializer=json.dumps,
deserializer=json.loads,
)

db = client2.db('test', username='root', password='')`

But if we pass two hosts and one of the server is down, the call to connect fails with the below error

File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=9529): Max retries exceeded with url: /_db/test/_api/collection (Caused by NewConnectionError('<u rllib3.connection.HTTPConnection object at 0x1091a7b80>: Failed to establish a new connection: [Errno 61] Connection refused'))

Is it possible to implement the fallback host like we have in Java driver - https://www.arangodb.com/docs/stable/drivers/java-reference-setup.html#fallback-hosts

Duplicate of #179