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!

Hmm…perhaps a different timeout option on the repo? IIRC there is something like pool_timeout

Hey thanks for getting back, from this changelog it looks like :pool_timeout has been removed since v3.0.4, which is why I thought not to try it, seeing as AshPostgres.Repo is also an Ecto.Repo. Can I check if it is still a valid configuration?

Hmm…okay, maybe just faulty memory on my part. Seems strange that you’d be seeing this behavior :thinking: 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?