Clean staled sesssions
This commit is contained in:
parent
9df6345a6c
commit
0e2e4e73ca
|
@ -321,7 +321,7 @@ resume(SPid, SessAttrs) ->
|
||||||
%% @doc Discard the session
|
%% @doc Discard the session
|
||||||
-spec(discard(spid(), ByPid :: pid()) -> ok).
|
-spec(discard(spid(), ByPid :: pid()) -> ok).
|
||||||
discard(SPid, ByPid) ->
|
discard(SPid, ByPid) ->
|
||||||
gen_server:call(SPid, {discard, ByPid}, infinity).
|
gen_server:call(SPid, {discard, ByPid}).
|
||||||
|
|
||||||
-spec(update_expiry_interval(spid(), timeout()) -> ok).
|
-spec(update_expiry_interval(spid(), timeout()) -> ok).
|
||||||
update_expiry_interval(SPid, Interval) ->
|
update_expiry_interval(SPid, Interval) ->
|
||||||
|
@ -329,7 +329,7 @@ update_expiry_interval(SPid, Interval) ->
|
||||||
|
|
||||||
-spec(close(spid()) -> ok).
|
-spec(close(spid()) -> ok).
|
||||||
close(SPid) ->
|
close(SPid) ->
|
||||||
gen_server:call(SPid, close, infinity).
|
gen_server:call(SPid, close).
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% gen_server callbacks
|
%% gen_server callbacks
|
||||||
|
|
|
@ -116,6 +116,7 @@ discard_session(ClientId, ConnPid) when is_binary(ClientId) ->
|
||||||
try emqx_session:discard(SessPid, ConnPid)
|
try emqx_session:discard(SessPid, ConnPid)
|
||||||
catch
|
catch
|
||||||
_:Error:_Stk ->
|
_:Error:_Stk ->
|
||||||
|
unregister_session(ClientId, SessPid),
|
||||||
?LOG(warning, "Failed to discard ~p: ~p", [SessPid, Error])
|
?LOG(warning, "Failed to discard ~p: ~p", [SessPid, Error])
|
||||||
end
|
end
|
||||||
end, lookup_session_pids(ClientId)).
|
end, lookup_session_pids(ClientId)).
|
||||||
|
|
Loading…
Reference in New Issue