Skip to content

Commit

Permalink
Increase mongoose_wpool_mgr:start and stop timeout to 30 seconds
Browse files Browse the repository at this point in the history
Use mongoose_task:run_tracked to print the wpool start progress
  • Loading branch information
arcusfelis committed Dec 13, 2024
1 parent 0dcad73 commit 13aa6e0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/wpool/mongoose_wpool_mgr.erl
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ start_link(Type) ->

start(Type, Host, Tag, PoolOpts, ConnOpts) ->
ok = ensure_started(Type),
gen_server:call(name(Type), {start_pool, Host, Tag, PoolOpts, ConnOpts}).
gen_server:call(name(Type), {start_pool, Host, Tag, PoolOpts, ConnOpts}, timer:seconds(30)).

stop(Type, Host, Tag) ->
gen_server:call(name(Type), {stop_pool, Host, Tag}).
gen_server:call(name(Type), {stop_pool, Host, Tag}, timer:seconds(30)).

-spec name(mongoose_wpool:pool_type()) -> mongoose_wpool:proc_name().
name(Type) ->
Expand All @@ -93,7 +93,11 @@ handle_call({start_pool, Host, Tag, WpoolOpts, ConnOpts}, _From,
#state{type = Type, pools = Pools, monitors = Monitors} = State) ->
?LOG_INFO(#{what => pool_starting, pool_type => Type, tag => Tag, server => Host,
pool_opts => WpoolOpts}),
case mongoose_wpool:call_start_callback(Type, [Host, Tag, WpoolOpts, ConnOpts]) of
F = fun() ->
mongoose_wpool:call_start_callback(Type, [Host, Tag, WpoolOpts, ConnOpts])
end,
Info = #{task => start_pool, tag => Tag},
case mongoose_task:run_tracked(Info, F) of
{_, Pid} = OkReply when is_pid(Pid) ->
Ref = erlang:monitor(process, Pid),
Key = {Type, Host, Tag},
Expand Down

0 comments on commit 13aa6e0

Please sign in to comment.