fix(mqtt): drop all local messages in session deliver
This commit is contained in:
parent
7b7fb6c09e
commit
48cf089870
|
@ -291,16 +291,16 @@ stats(Session) -> info(?STATS_KEYS, Session).
|
||||||
|
|
||||||
ignore_local(ClientInfo, Delivers, Subscriber, Session) ->
|
ignore_local(ClientInfo, Delivers, Subscriber, Session) ->
|
||||||
Subs = info(subscriptions, Session),
|
Subs = info(subscriptions, Session),
|
||||||
lists:dropwhile(
|
lists:filter(
|
||||||
fun({deliver, Topic, #message{from = Publisher} = Msg}) ->
|
fun({deliver, Topic, #message{from = Publisher} = Msg}) ->
|
||||||
case maps:find(Topic, Subs) of
|
case maps:find(Topic, Subs) of
|
||||||
{ok, #{nl := 1}} when Subscriber =:= Publisher ->
|
{ok, #{nl := 1}} when Subscriber =:= Publisher ->
|
||||||
ok = emqx_hooks:run('delivery.dropped', [ClientInfo, Msg, no_local]),
|
ok = emqx_hooks:run('delivery.dropped', [ClientInfo, Msg, no_local]),
|
||||||
ok = emqx_metrics:inc('delivery.dropped'),
|
ok = emqx_metrics:inc('delivery.dropped'),
|
||||||
ok = emqx_metrics:inc('delivery.dropped.no_local'),
|
ok = emqx_metrics:inc('delivery.dropped.no_local'),
|
||||||
true;
|
false;
|
||||||
_ ->
|
_ ->
|
||||||
false
|
true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
Delivers
|
Delivers
|
||||||
|
|
Loading…
Reference in New Issue