<p>I have a Kubernetes Multinode system set up 3 three nodes. I am creating a connection between a pod on Node 2 to the Arango deployment using PyArango, the Arango Deployment has two coordinator pods one on Node 2 and one on Node 3.</p>
<p>I'm testing out how resilient the system is and I've noticed an issue. It seems that if I'm updating collections on Arango and my program (running on Node 2) connects to the Arango Coordinator pod on Node 3 and I power off Node 3, the connection will not time out, it will simply stay put for as long as 20 minutes.</p>
<p>I want the connection to timeout if the connection is idle or getting no response after 30 seconds.</p>
<p>I've tried some different things using the PyArango methods and no luck. How do I get python or PyArango to timeout on a stale connection asap?</p>
<p>At the minute this is my a snippet of the connection settings code:</p>
<pre><code> retry_policy = Retry(total=0, connect=0, read=0 ,
                       other=0, backoff_factor=0)
  while conn == None:
    try:
        conn = Connection(arango_url, username, password,
                          max_retries=retry_policy)
        conn.session.session.headers['Retry-After'] = '10'
        conn.session.session.headers['Keep-Alive'] = 'timeout=5'
      else:
        conn = Connection(arangoURL=arango_url, max_retries=retry_policy)

        conn.session.session.headers['Retry-After'] = '10'
        conn.session.session.headers['Keep-Alive'] = 'timeout=5'
</code></pre>
<p>Any help would be great!</p>

Joel Gray
<p>You could always add connecting string to your Connection String:
connect timeout=180;</p>
<p>This Connection Timeout is for the amount of time it takes to resolve the initial connection to the database. You can refer to this in <a href="https://learn.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlconnection.connectiontimeout?redirectedfrom=MSDN&amp;view=dotnet-plat-ext-7.0#System_Data_SqlClient_SqlConnection_ConnectionTimeout" rel="nofollow noreferrer">SQL Connection timeout</a> property doc</p>
<p>Or else refer to this <a href="https://stackoverflow.com/a/71868410/19230181">SO</a>. You can increase the HTTP client's <a href="https://docs.python-requests.org/en/latest/user/advanced/#timeouts" rel="nofollow noreferrer">timeout</a> by using a custom <a href="https://docs.python-arango.com/en/main/http.html" rel="nofollow noreferrer">HTTP client for Arango</a>.
The default is set <a href="https://github.com/ArangoDB-Community/python-arango/blob/ff990fde4a4403da170d8759adb46a7100e403a6/arango/http.py#L69" rel="nofollow noreferrer">here</a> to 60 seconds.</p>
