Skip to content

Commit

Permalink
Merge pull request #8 from posilva/feature/avoid_race_condition_on_ad…
Browse files Browse the repository at this point in the history
…d_pool

Handle {error, already_exists} when  processes try to add the same pool
  • Loading branch information
nalundgaard authored Mar 21, 2017
2 parents a5397c8 + 7b40360 commit 97f36fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lhttpc_manager.erl
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ ensure_call(Pool, Pid, Host, Port, Ssl, Options) ->
case lhttpc:add_pool(Pool, ConnTimeout, PoolMaxSize) of
{ok, _Pid} ->
ensure_call(Pool, Pid, Host, Port, Ssl, Options);
_ ->
{error, already_exists} ->
ensure_call(Pool, Pid, Host, Port, Ssl, Options);
_ ->
%% Failed to create pool, exit as expected
exit({noproc, Reason})
end;
Expand Down

0 comments on commit 97f36fd

Please sign in to comment.