fix session
This commit is contained in:
parent
d09a0787ea
commit
8ea0707684
|
@ -73,9 +73,9 @@ start_servers(Sup) ->
|
|||
{"emqttd session manager", {supervisor, emqttd_sm_sup}},
|
||||
{"emqttd session supervisor", {supervisor, emqttd_session_sup}},
|
||||
{"emqttd pubsub", {supervisor, emqttd_pubsub_sup}},
|
||||
{"emqttd broker", emqttd_broker},
|
||||
{"emqttd stats", emqttd_stats},
|
||||
{"emqttd metrics", emqttd_metrics},
|
||||
{"emqttd broker", emqttd_broker},
|
||||
{"emqttd alarm", emqttd_alarm},
|
||||
{"emqttd mode supervisor", emqttd_mod_sup},
|
||||
{"emqttd bridge supervisor", {supervisor, emqttd_bridge_sup}},
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
|
||||
terminate/2, code_change/3]).
|
||||
|
||||
-record(state, {id, client_statsfun, sess_statsfun}).
|
||||
-record(state, {id, statsfun}).
|
||||
|
||||
-define(SM_POOL, sm_pool).
|
||||
|
||||
|
@ -67,12 +67,12 @@
|
|||
%% @doc Start a session manager
|
||||
%% @end
|
||||
%%------------------------------------------------------------------------------
|
||||
-spec start_link(Id, ClientStatsFun, SessStatsFun) -> {ok, pid()} | ignore | {error, any()} when
|
||||
-spec start_link(Id, SessStatsFun) -> {ok, pid()} | ignore | {error, any()} when
|
||||
Id :: pos_integer(),
|
||||
ClientStatsFun :: fun(),
|
||||
%ClientStatsFun :: fun(),
|
||||
SessStatsFun :: fun().
|
||||
start_link(Id, ClientStatsFun, SessStatsFun) ->
|
||||
gen_server:start_link(?MODULE, [Id, ClientStatsFun, SessStatsFun], []).
|
||||
start_link(Id, SessStatsFun) ->
|
||||
gen_server:start_link(?MODULE, [Id, SessStatsFun], []).
|
||||
|
||||
%%------------------------------------------------------------------------------
|
||||
%% @doc Pool name.
|
||||
|
|
|
@ -46,13 +46,13 @@ init([]) ->
|
|||
{write_concurrency, true}]),
|
||||
Schedulers = erlang:system_info(schedulers),
|
||||
gproc_pool:new(emqttd_sm:pool(), hash, [{size, Schedulers}]),
|
||||
ClientStatsFun = emqttd_stats:statsfun('clients/count', 'clients/max'),
|
||||
%%ClientStatsFun = emqttd_stats:statsfun('clients/count', 'clients/max'),
|
||||
SessStatsFun = emqttd_stats:statsfun('sessions/count', 'sessions/max'),
|
||||
Children = lists:map(
|
||||
fun(I) ->
|
||||
Name = {emqttd_sm, I},
|
||||
gproc_pool:add_worker(emqttd_sm:pool(), Name, I),
|
||||
{Name, {emqttd_sm, start_link, [I, ClientStatsFun, SessStatsFun]},
|
||||
{Name, {emqttd_sm, start_link, [I, SessStatsFun]},
|
||||
permanent, 10000, worker, [emqttd_sm]}
|
||||
end, lists:seq(1, Schedulers)),
|
||||
{ok, {{one_for_all, 10, 100}, Children}}.
|
||||
|
|
Loading…
Reference in New Issue