Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specified timeout for an Ash action does not override the global timeout #448

Open
Fasp96 opened this issue Dec 19, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@Fasp96
Copy link

Fasp96 commented Dec 19, 2024

Describe the bug

Encountered an issue where specifying a timeout for an Ash action does not override the default 15000ms timeout. Despite following the Ash documentation on timeouts, the action fails with the following error:

[error] Postgrex.Protocol (#PID<0.442.0>) disconnected: ** (DBConnection.ConnectionError) client #PID<0.866.0> timed out because it queued and checked out the connection for longer than 15000ms

To Reproduce

Example code:

defp fetch_report_data(resource, report_filters, actor) do
  case resource
       |> Ash.read(actor: actor, timeout: :timer.minutes(5)) do
    {:ok, records} -> {:ok, resource, records}
    error -> error
  end
end

Steps to reproduce:

Define an Ash resource.

Call the Ash.read/2 function with a custom timeout (:timer.minutes(5)).

Observe the timeout error despite specifying a longer timeout.

Expected behavior

I expected the timeout: :timer.minutes(5) option in the Ash.read/2 function to increase the timeout duration for this specific call to 5 minutes.

Additional context

I noticed that increasing the timeout globally in the Ecto.Adapters.Postgres configuration resolves the issue, but this is not desirable as I only want to increase the timeout for this specific action. The documentation mentions that the timeout option should work for individual calls, but it does not seem to be applied here.

@Fasp96 Fasp96 added bug Something isn't working needs review labels Dec 19, 2024
@zachdaniel zachdaniel moved this to Up Next in Ash Framework Roadmap Dec 20, 2024
@zachdaniel zachdaniel moved this from Up Next to Soon in Ash Framework Roadmap Dec 20, 2024
@zachdaniel
Copy link
Contributor

Please see if adding transaction? true (I accidentally told you to try transaction? false in discord) to see if that is a workaround :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants