Permalink
Browse files

make worker sup temporary

  • Loading branch information...
davidsulc committed Sep 6, 2018
1 parent 4a70624 commit b2e3c20020d3d9e9c90295fd872a3d497b73e2cf
Showing with 6 additions and 1 deletion.
  1. +5 −0 lib/pool_toy/pool_man.ex
  2. +1 −1 lib/pool_toy/worker_sup.ex
View
@@ -88,6 +88,7 @@ defmodule PoolToy.PoolMan do
def handle_info(:start_worker_sup, %State{pool_sup: sup} = state) do
{:ok, worker_sup} = Supervisor.start_child(sup, PoolToy.WorkerSup)
Process.link(worker_sup)
state =
state
@@ -107,6 +108,10 @@ defmodule PoolToy.PoolMan do
end
end
def handle_info({:EXIT, pid, reason}, %State{worker_sup: pid} = state) do
{:stop, {:worker_sup_exit, reason}, state}
end
def handle_info({:EXIT, pid, _reason}, %State{workers: workers, monitors: monitors} = state) do
case :ets.lookup(monitors, pid) do
[{pid, ref}] ->
@@ -1,5 +1,5 @@
defmodule PoolToy.WorkerSup do
use DynamicSupervisor
use DynamicSupervisor, restart: :temporary
def start_link(args) do
DynamicSupervisor.start_link(__MODULE__, args)

0 comments on commit b2e3c20

Please sign in to comment.