data-api-client
data-api-client copied to clipboard
Client timeout configuration
Possibly related to #40, which was closed.
I'd like to be able to specify a timeout on the client, so that I can detect slow responses (usually due to the DB resuming after auto-pause) before my Lambda function times out, and handle them appropriately.
I've tried passing through RDSDataService timeout properties via options but they have no effect.
require('data-api-client')({
...
options: {
httpOptions: {
// Low values for test purposes
connectTimeout: 10,
timeout: 10
}
})}
This isn't surprising as the socket connection will be made promptly, even if the database query is slow.
Is there anything else that I can try? Appreciate that this is probably a limitation of the underlying client/service rather than your (extremely useful) wrapper.
I suppose that one approach would be to apply a timeout to the promise in application code, e.g. https://italonascimento.github.io/applying-a-timeout-to-your-promises
Hello Im having timeout connection issue in 3 seconds , using Lambda any idea ?