revert(ds): Don't duplicate the clean start in session_ds
This commit is contained in:
parent
839f9dbedb
commit
bd7a84fe3e
|
@ -153,8 +153,6 @@ open(#{clientid := ClientID} = _ClientInfo, ConnInfo) ->
|
||||||
%% somehow isolate those idling not-yet-expired sessions into a separate process
|
%% somehow isolate those idling not-yet-expired sessions into a separate process
|
||||||
%% space, and move this call back into `emqx_cm` where it belongs.
|
%% space, and move this call back into `emqx_cm` where it belongs.
|
||||||
ok = emqx_cm:discard_session(ClientID),
|
ok = emqx_cm:discard_session(ClientID),
|
||||||
case maps:get(clean_start, ConnInfo, false) of
|
|
||||||
false ->
|
|
||||||
case session_open(ClientID, ConnInfo) of
|
case session_open(ClientID, ConnInfo) of
|
||||||
Session0 = #{} ->
|
Session0 = #{} ->
|
||||||
ensure_timers(),
|
ensure_timers(),
|
||||||
|
@ -163,10 +161,6 @@ open(#{clientid := ClientID} = _ClientInfo, ConnInfo) ->
|
||||||
{true, Session, []};
|
{true, Session, []};
|
||||||
false ->
|
false ->
|
||||||
false
|
false
|
||||||
end;
|
|
||||||
true ->
|
|
||||||
session_drop(ClientID),
|
|
||||||
false
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
ensure_session(ClientID, ConnInfo, Conf) ->
|
ensure_session(ClientID, ConnInfo, Conf) ->
|
||||||
|
@ -554,7 +548,7 @@ session_open(SessionId, NewConnInfo) ->
|
||||||
EI = expiry_interval(ConnInfo),
|
EI = expiry_interval(ConnInfo),
|
||||||
case ?IS_EXPIRED(NowMS, DisconnectedAt, EI) of
|
case ?IS_EXPIRED(NowMS, DisconnectedAt, EI) of
|
||||||
true ->
|
true ->
|
||||||
%% Should we drop the session now, or leave it to session GC?
|
session_drop(SessionId),
|
||||||
false;
|
false;
|
||||||
false ->
|
false ->
|
||||||
%% new connection being established
|
%% new connection being established
|
||||||
|
@ -831,8 +825,13 @@ session_drop_pubranges(DSSessionId) ->
|
||||||
%%--------------------------------------------------------------------------------
|
%%--------------------------------------------------------------------------------
|
||||||
|
|
||||||
transaction(Fun) ->
|
transaction(Fun) ->
|
||||||
|
case mnesia:is_transaction() of
|
||||||
|
true ->
|
||||||
|
Fun();
|
||||||
|
false ->
|
||||||
{atomic, Res} = mria:transaction(?DS_MRIA_SHARD, Fun),
|
{atomic, Res} = mria:transaction(?DS_MRIA_SHARD, Fun),
|
||||||
Res.
|
Res
|
||||||
|
end.
|
||||||
|
|
||||||
ro_transaction(Fun) ->
|
ro_transaction(Fun) ->
|
||||||
{atomic, Res} = mria:ro_transaction(?DS_MRIA_SHARD, Fun),
|
{atomic, Res} = mria:ro_transaction(?DS_MRIA_SHARD, Fun),
|
||||||
|
|
Loading…
Reference in New Issue