Zachareee
Ash.Postgres timeout
Hi, I’m working with a Postgres database which tends to take really long to retrieve data, it’s a simple :read action with a filter. There are no optimisations to the database that can be done on my side and so I’m looking to increase the timeout when querying the AshPostgres.Repo to avoid this error:
Postgrex.Protocol (#PID<0.359.0>) disconnected: ** (DBConnection.ConnectionError) client #PID<0.739.0> timed out because it queued and checked out the connection for longer than 15000ms
I have tried setting timeout to :infinity in config/dev.exs as so:
config :hachiware, Hachiware.Reports.Repo,
hostname: "hachiware-db",
username: "postgres",
password: "postgres",
database: "postgres",
port: 5432,
show_sensitive_data_on_connection_error: true,
pool_size: 10,
timeout: :infinity
On the repo:
use AshPostgres.Repo, otp_app: :hachiware, timeout: :infinity
On the domain:
execution do
timeout :infinity
end
As well as on the Ash.read! action:
__MODULE__
|> Ash.read!(timeout: :infinity)
However it feels that nothing I’m doing works at all, any advice and help is appreciated!
Marked As Solved
zachdaniel
Hmm…okay, maybe just faulty memory on my part. Seems strange that you’d be seeing this behavior
The default is 15000, and that’s the error you’re getting so it seems like it’s just somehow not being set? Setting timeout to infinity should AFAIK remove any kind of Postgrex timeout like that. Might be worth checking some base assumptions. Do you have multiple repos? Is this issue happening in production, implying a need to set this config in prod.exs (or runtime.exs) as well? If nothing there helps, perhaps you could put together a reproduction and open an issue?
Last Post!
Zachareee
Hi sflr, I realised I put the timeout on the wrong repo (yes I’m working on multiple repos), thank you for the help!
Popular in Questions
Other popular topics
Latest Ash Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









