I have an action in my entity resource that is written like this:
read :all_stale do
description "Returns all entities that are stale"
pagination keyset?: true
filter expr(status == :stale)
prepare build(
load: [
grantee_records: :property_by_rebuilt_id,
grantor_records: :property_by_rebuilt_id
],
sort: :id
)
end
To call it, I run this code:
Entity
|> Ash.Query.for_read(:all_stale, %{})
|> Markets.stream!(batch_size: @chunk_size, timeout: :infinity)
...
As you can see, I’m passing timeout: :infinity
to the Markets.stream!/2
call. I expected that this timeout would be also used on any “internal” load the action needs to do, but that is not what happens and I end up having this error when Ash tries to load property_by_rebuilt_id
:
** (Ash.Error.Invalid) Input Invalid
* Core.Pacman.Markets.Property.read timed out after 180000ms.
The default timeout can be configured on the api,
execution do
timeout :timer.seconds(60)
end
Each request can be configured with a timeout via `Ash.Changeset.timeout/2` or `Ash.Query.timeout/2`.
at grantor_records, property_by_rebuilt_id
(elixir 1.16.3) lib/process.ex:860: Process.info/2
(ash 2.20.3) lib/ash/error/exception.ex:59: Ash.Error.Invalid.Timeout.exception/1
(ash 2.20.3) lib/ash/engine/engine.ex:162: Ash.Engine.task_with_timeout/5
(ash 2.20.3) lib/ash/actions/read/read.ex:537: Ash.Actions.Read.maybe_in_transaction/3
(ash 2.20.3) lib/ash/actions/read/read.ex:216: Ash.Actions.Read.do_run/3
(ash 2.20.3) lib/ash/actions/read/read.ex:49: anonymous fn/3 in Ash.Actions.Read.run/3
(ash 2.20.3) lib/ash/actions/read/read.ex:48: Ash.Actions.Read.run/3
(ash 2.20.3) lib/ash/actions/read/relationships.ex:333: anonymous fn/2 in Ash.Actions.Read.Relationships.do_fetch_related_records/3
(ash 2.20.3) lib/ash/engine/engine.ex:514: anonymous fn/4 in Ash.Engine.async/2
(elixir 1.16.3) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
(elixir 1.16.3) lib/task/supervised.ex:36: Task.Supervised.reply/4
(elixir 1.16.3) lib/process.ex:860: Process.info/2
(ash 2.20.3) lib/ash/error/exception.ex:59: Ash.Error.Invalid.exception/1
(ash 2.20.3) lib/ash/error/error.ex:600: Ash.Error.choose_error/2
(ash 2.20.3) lib/ash/error/error.ex:260: Ash.Error.to_error_class/2
(ash 2.20.3) lib/ash/actions/read/read.ex:281: Ash.Actions.Read.do_run/3
(ash 2.20.3) lib/ash/actions/read/read.ex:49: anonymous fn/3 in Ash.Actions.Read.run/3
(ash 2.20.3) lib/ash/actions/read/read.ex:48: Ash.Actions.Read.run/3
(ash 2.20.3) lib/ash/actions/read/relationships.ex:333: anonymous fn/2 in Ash.Actions.Read.Relationships.do_fetch_related_records/3
(ash 2.20.3) lib/ash/engine/engine.ex:514: anonymous fn/4 in Ash.Engine.async/2
(elixir 1.16.3) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
(elixir 1.16.3) lib/task/supervised.ex:36: Task.Supervised.reply/4
Unfortunately, this is Ash 2.20.3, not Ash 3, not sure if the same issue happens in Ash 3.