interesting. I think it may be, but it’s a bit complicated. The load itself does a read which has a timeout on it, and I don’t think we do anything to indicate to load read actions that they should adopt the parent’s timeout, and its not entirely clear if they should adopt the parent’s timeout TBH. Its…unclear
You could conditionally add the timeout in the target action for only when its being run directly by switching on the presence of query.context[:accessing_from] I believe.
But if I don’t specify a read_action then the load would respect the timeout value correct?
At least that is what I would expect from a timeout field in a load call haha. And, of course, if that is the case, I would expect the same to be true if the read_action is set as that is just a implementation detail that the caller (the one doing the load) doesn’t need to concern about it.
I actually think that this particular behavior is more correct, considering multiple options. The concept is that when loading relationships we honor the rules on the relevant read action. That action is, by default, the primary read action. You’ve set a timeout on that read action, which means it applies when being used to load relationships also.
By “this particular behavior” you mean applying the loadtimeout value to all read calls the function does behind the scene or the other way around?
You’ve set a timeout on that read action, which means it applies when being used to load relationships also.
Where was that set actually? What I set was only a custom read action with the read_action option and then I set the load timeout in the load call which I expected to be applied to that custom read call too.
with_timeout(:infinity, fn ->
# this timeout is where the error comes from
with_timeout(180000, fn ->
:timer.sleep(500000)
end)
end)
The related action used for the read has a timeout. Just because the outer action call has an infinite timeout, it still calls something with its own shorter timeout.
Ah, I see, but in that case, shouldn’t the inner call inherit the timeout of the outer call? Otherwise, what exactly is the point of the timeout option in a load call?