Skip to content

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

Open
@Fasp96

Description

@Fasp96

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Soon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions