tiny improve

This commit is contained in:
Egor Kislitsyn 2019-01-30 22:56:59 +07:00
parent 1724a6b34b
commit ab31adf15b
1 changed files with 6 additions and 2 deletions

View File

@ -102,7 +102,11 @@ def handle_info({:DOWN, ref, :process, _pid, _reason}, state) do
running_jobs = :sets.del_element(ref, running_jobs) running_jobs = :sets.del_element(ref, running_jobs)
state = state |> remove_ref(ref) |> maybe_start_job(queue_name, running_jobs, queue) state =
state
|> remove_ref(ref)
|> update_queue(queue_name, {running_jobs, queue})
|> maybe_start_job(queue_name, running_jobs, queue)
{:noreply, state} {:noreply, state}
end end
@ -118,7 +122,7 @@ def maybe_start_job(state, queue_name, running_jobs, queue) do
|> add_ref(queue_name, mref) |> add_ref(queue_name, mref)
|> update_queue(queue_name, {:sets.add_element(mref, running_jobs), queue}) |> update_queue(queue_name, {:sets.add_element(mref, running_jobs), queue})
else else
update_queue(state, queue_name, {running_jobs, queue}) state
end end
end end