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