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
MatchError in Task.Supervisor.async/1 in case of custom max_children option #7786
Comments
Good catch. Not sure about the behaviour here. We can't return |
Yeah, I see. Also we have the same issue with |
|
So, what if add something like |
@van-mronov we generally do not add new exceptions for cases like this. But it may be worth if it can be raised on async and used as a signal on async_stream. |
The interaction between a task supervisor with A possible desired behaviour there could be that if the child can't be started right away the stream will block until it can start (or the timeout fires). Returning |
Perhaps, it makes sense to use |
If you are using max_concurrency, i would say there is no reason to set max_children. Maybe we should clarify this in the docs. |
Related to #7786. Before this commit, when reaching the max children under a Task.Supervisor, we failed with a MatchError. Now, we're handling the "{:error, :max_children}" that we get from the DynamicSupervisor and raising a more meaningful error message. We're raising instead of returning an error tuple because async/2,4 are supposed to return the task directly.
…8238) Related to #7786. Before this commit, when reaching the max children under a Task.Supervisor, we failed with a MatchError. Now, we're handling the "{:error, :max_children}" that we get from the DynamicSupervisor and raising a more meaningful error message. We're raising instead of returning an error tuple because async/2,4 are supposed to return the task directly.
Closing in favor of PR. |
Environment
Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.7.0-dev (c3b0caa) (compiled with Erlang/OTP 21)
macOS High Sierra
Current behavior
Expected behavior
Task.Supervisor.async/1
and other calls to start async task should return{:error, :max_children}
ifDynamicSupervisor
cannot start child.The text was updated successfully, but these errors were encountered: