[erlang-questions] How to get a worker's pid() after restarted by supervisor?
Thu Aug 29 11:10:31 CEST 2013
You have to maintain mapping of uri to pid in external table (e.g ETS)
However, there is number of open source project that addresses this issue. For example gproc by Ulf.
However, I had exactly the same task / problem like your and made a library to manage those processes. You can find it here:
On 29.8.2013, at 10.03, fxmy wang <> wrote:
> Hi dear fellow erlangers,
> New to Erlang, I'm building a small comment backend for practice. By my design there are many worker processes that handle comments posted from different URLs, and these workers are all under simple_one_for_one supervision.
> I also decide to start a dispatcher process to map certain URL comment to corresponding worker by worker_sup:start_child(URL) and then store returned Pid.
> So here comes the problem, I expect that worker may be restarted by supervisor. Is there a way to get the worker's Pid after restarted by supervisor, so that I can keep track of which URL comment should go for which worker process?
> Hope express myself clearly cause not a native speaker :)
> erlang-questions mailing list
More information about the erlang-questions