refactor: disregard impossible case
This commit is contained in:
parent
922ca5e141
commit
60ae3c15c8
|
@ -146,16 +146,11 @@ del_subscription(IteratorID, TopicFilterBin, DSSessionID) ->
|
|||
begin
|
||||
TopicFilter = emqx_topic:words(TopicFilterBin),
|
||||
Ctx = #{iterator_id => IteratorID},
|
||||
case IteratorID of
|
||||
undefined ->
|
||||
ok;
|
||||
_ ->
|
||||
?tp_span(
|
||||
persistent_session_ds_close_iterators,
|
||||
Ctx,
|
||||
ok = ensure_iterator_closed_on_all_shards(IteratorID)
|
||||
)
|
||||
end,
|
||||
?tp_span(
|
||||
persistent_session_ds_close_iterators,
|
||||
Ctx,
|
||||
ok = ensure_iterator_closed_on_all_shards(IteratorID)
|
||||
),
|
||||
?tp_span(
|
||||
persistent_session_ds_iterator_delete,
|
||||
Ctx,
|
||||
|
|
|
@ -357,8 +357,13 @@ unsubscribe(
|
|||
session().
|
||||
remove_persistent_subscription(Session, TopicFilterBin, ClientId) ->
|
||||
Iterators = Session#session.iterators,
|
||||
IteratorId = maps:get(TopicFilterBin, Iterators, undefined),
|
||||
_ = emqx_persistent_session_ds:del_subscription(IteratorId, TopicFilterBin, ClientId),
|
||||
case maps:get(TopicFilterBin, Iterators, undefined) of
|
||||
undefined ->
|
||||
ok;
|
||||
IteratorId ->
|
||||
_ = emqx_persistent_session_ds:del_subscription(IteratorId, TopicFilterBin, ClientId),
|
||||
ok
|
||||
end,
|
||||
Session#session{iterators = maps:remove(TopicFilterBin, Iterators)}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue