Make some processes hibernate after 1s.

This commit is contained in:
Feng Lee 2018-12-04 23:22:39 +08:00 committed by turtleDeng
parent a32b043980
commit 64f62fa0ce
4 changed files with 5 additions and 4 deletions

View File

@ -56,7 +56,7 @@
-spec(start_link(atom(), pos_integer()) -> {ok, pid()} | ignore | {error, term()}). -spec(start_link(atom(), pos_integer()) -> {ok, pid()} | ignore | {error, term()}).
start_link(Pool, Id) -> start_link(Pool, Id) ->
gen_server:start_link({local, emqx_misc:proc_name(?MODULE, Id)}, ?MODULE, gen_server:start_link({local, emqx_misc:proc_name(?MODULE, Id)}, ?MODULE,
[Pool, Id], [{hibernate_after, 2000}]). [Pool, Id], [{hibernate_after, 1000}]).
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
%% Subscribe %% Subscribe

View File

@ -42,7 +42,7 @@
-spec(start_link() -> emqx_types:startlink_ret()). -spec(start_link() -> emqx_types:startlink_ret()).
start_link() -> start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [], [{hibernate_after, 60000}]). gen_server:start_link({local, ?SERVER}, ?MODULE, [], [{hibernate_after, 1000}]).
-spec(stop() -> ok). -spec(stop() -> ok).
stop() -> stop() ->

View File

@ -35,7 +35,8 @@ start_link() ->
%% @doc Start pool. %% @doc Start pool.
-spec(start_link(atom(), pos_integer()) -> emqx_types:startlink_ret()). -spec(start_link(atom(), pos_integer()) -> emqx_types:startlink_ret()).
start_link(Pool, Id) -> start_link(Pool, Id) ->
gen_server:start_link({local, emqx_misc:proc_name(?MODULE, Id)}, ?MODULE, [Pool, Id], []). gen_server:start_link({local, emqx_misc:proc_name(?MODULE, Id)},
?MODULE, [Pool, Id], [{hibernate_after, 1000}]).
%% @doc Submit work to the pool. %% @doc Submit work to the pool.
-spec(submit(task()) -> any()). -spec(submit(task()) -> any()).

View File

@ -68,7 +68,7 @@ mnesia(copy) ->
-spec(start_link(atom(), pos_integer()) -> {ok, pid()} | ignore | {error, term()}). -spec(start_link(atom(), pos_integer()) -> {ok, pid()} | ignore | {error, term()}).
start_link(Pool, Id) -> start_link(Pool, Id) ->
gen_server:start_link({local, emqx_misc:proc_name(?MODULE, Id)}, gen_server:start_link({local, emqx_misc:proc_name(?MODULE, Id)},
?MODULE, [Pool, Id], [{hibernate_after, 2000}]). ?MODULE, [Pool, Id], [{hibernate_after, 1000}]).
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
%% Route APIs %% Route APIs