Zachareee

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

zachdaniel

Creator of Ash

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?

Last Post!

Zachareee

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!

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement