Hi Derek

Why not spawn a new process and call DynamicSupervisor.terminate_child from
there? Perhaps using the Task module.

For me this would be preferable to making an async version of the function
as (in addition to keeping the DynamicSupervisor API simple) it leaves it
up to the caller to decide how the timeout should handled (should we crash,
retry, or discard the error?), and whether there should be a notification
of some kind when the call has succeeded.

Cheers,
Louis

On Tue, 15 Jan 2019 at 10:29 Derek Kraan <derek.kr...@gmail.com> wrote:

> Currently, a call to DynamicSupervisor.terminate_child waits until the
> process has exited (or the shutdown times out) before processing any other
> messages. This can take up to `shutdown` milliseconds, which could be a
> long time depending on what the application has configured.
>
> I have run into this problem before in my work, and solved it in my
> project by ensuring that a process is in a "ready to terminate" state
> before asking the DynamicSupervisor to terminate it. This works for us, but
> we have to be really careful with this and if we make a mistake it could
> have a huge performance impact.
>
> After reading the code, I think it is possible to process these
> terminations asynchronously. This would allow other work (including process
> restarts, starting new processes, terminating other processes) to continue
> unimpeded.
>
> The downside is that the DynamicSupervisor would get more complex. The
> upside is that we could solve a potentially big performance bottleneck in
> people's apps.
>
> Is this a change that would be considered?
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-core+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/0bab277d-588e-4901-ba82-fe82375db301%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/0bab277d-588e-4901-ba82-fe82375db301%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CABu8xFBFa38ROVYtJ4sHSJGAK9XuYqzYsVW6m1XJAiROt4%2Bjog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to