I am developing an API that fetches data from multiple remote databases. For each of these databases, an
Ecto.Repo is configured at runtime when the application starts.
When I am trying to fetch data from a disconnected database (network failure, database server not started, …), I get this error after a timeout:
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2657ms. This means requests are coming in and your connection pool cannot serve them fast enough. You can address this by: 1. Tracking down slow queries and making sure they are running fast enough 2. Increasing the pool_size (albeit it increases resource consumption) 3. Allowing requests to wait longer by increasing :queue_target and :queue_interval See DBConnection.start_link/2 for more information
Since a pool of connection is managed in the background, when I am attempting to query a disconnected database, would it be possible to get an immediate error indicating that no connection is available rather than having to wait around 2657ms?
Also, I would like my API to offer the possibility to get the status (online or disconnected) of each database without having to wait for a 2657ms timeout. Any idea if
Ecto.Repo allows that?