Skip to content

Commit 2fa3811

Browse files
committed
clean up error on repeated gproc_pool:new()
1 parent e9d73d6 commit 2fa3811

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/gproc_pool.erl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ handle_call(Req, From, S) ->
534534
try handle_call_(Req, From, S)
535535
catch
536536
error:Reason ->
537-
io:fwrite("server backtrace: ~p~n", [erlang:get_stacktrace()]),
538537
{reply, {badarg, Reason}, S}
539538
end.
540539

@@ -590,7 +589,11 @@ new_(Pool, Type, Opts) ->
590589
valid_type(Type),
591590
Size = proplists:get_value(size, Opts, 0),
592591
Workers = lists:seq(1, Size),
593-
gproc:reg_shared(K = ?POOL(Pool), {Size, Type}),
592+
K = ?POOL(Pool),
593+
try gproc:reg_shared(K, {Size, Type})
594+
catch
595+
error:_ -> error(exists)
596+
end,
594597
Opts1 =
595598
case lists:keyfind(auto_size, 1, Opts) of
596599
false ->

0 commit comments

Comments
 (0)