Reconnection and Timeout


I was testing how the java sdk handle reconnection and I would like some feedback on some behaviour I have seen.

If I stop the couchabse server, I can see the java SDK trying to reconnect every 4s which is great.

But the behaviour that surprised me was that it will still try to do the n1ql query and will fail after timeout of 75s… This could be problematic in my case as I will accumulate queries and they will be queued behind the other queries - and because each of them are taking 75s to timeout it will lead to OOM if I do not put a limit to the queue…

But I was wondering why the Java SDK is not basically throwing an exception to the client to indicate that it is not connected instead of trying to do the query? Is there a way to handle this case more gracefully? Maybe I could test if the SDK is connected before trying to query?

For the moment, I am tempted to reduce the default timeout but this could lead to issue with big queries that may take longer than whatever number I decide to use.

Does anyone has any advice on how best to handle this case?