<div dir="ltr">If I'm reading this correctly, your worker_sup will be restarted after the max_restarts is reached for the poolboy pool. This means that the caller can link or monitor worker_sup, correct? Or do you need a one_for_all strategy?<div><br></div><div>I have a suspicion dependencies (link/monitor) and discovery (gproc, registered names) are also being confused or conflated in your question.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 30, 2015 at 3:25 PM, David Leach <span dir="ltr"><<a href="mailto:dleach@wetafx.co.nz" target="_blank">dleach@wetafx.co.nz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi All,</p>
<p><br>
</p>
<p>We have an application that starts pools of different kinds of workers and we want to offer the caller the ability to "link" to a pool of workers. We're using poolboy to manage the pools and gproc for naming the pools and ensuring startup is complete before
returning a reference to the caller. We don't want to link to poolboy, because it can and should be restarted by the supervisor supervising it. The behavior we want is, if the supervisor managing poolboy reaches its maximum restarts the caller who is linked
also dies. We also want that pool to disappear if the caller dies and the caller can restart it again. Structure looks a little like this:</p>
<p><br>
</p>
<p><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> pool_manager</span><br>
</p>
<p>super_sup -> worker_sup -></p>
<p><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> </span><span> poolboy</span><br>
</p>
<p><span><br>
</span></p>
<p>Right now, the caller is linked to the worker_sup so that if the worker_sup goes down caller also goes down. The pool_manager monitors the caller and sends exit(WorkerSupPid, shutdown) if the caller goes down so that the pool gets cleaned up.</p>
<p><br>
</p>
<p>Is there a better way of doing this? Better being easier for someone reading the code to understand quickly or more reliably if there is a problem with this implementation? </p>
<p><br>
</p>
<p>We thought about having the super_sup start two children, one of them performing the role of the pool_manager in this situation . But that seems a bit excessive, and how might one name it clearly to differentiate the roles of the pool_manager and it. The
pool manager takes care of details of the pool and translates the reference the caller has to a pid.</p>
<p><br>
</p>
<p>Thanks in Advance,</p>
<p><br>
</p>
<p>David</p>
</div>
</div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>