fix(bridges): function clause when a non-ingress bridge coexists with an egress bridge
This was not caught by our tests because we always test bridge types in isolation. So, if the config only contains ingress-only bridges, the `on_message_publish` hook is never installed. In a real system, if there are bridges of mixed types in the config, the hook might be installed, and `emqx_bridge:get_matched_bridge_id` would crash when iterating over the ingress bridges.
This commit is contained in:
parent
0587e0d3f3
commit
3954b7bde2
|
@ -411,7 +411,9 @@ get_matched_bridge_id(BType, Conf, Topic, BName, Acc) when ?EGRESS_DIR_BRIDGES(B
|
||||||
do_get_matched_bridge_id(Topic, Filter, BType, BName, Acc)
|
do_get_matched_bridge_id(Topic, Filter, BType, BName, Acc)
|
||||||
end;
|
end;
|
||||||
get_matched_bridge_id(mqtt, #{egress := #{local := #{topic := Filter}}}, Topic, BName, Acc) ->
|
get_matched_bridge_id(mqtt, #{egress := #{local := #{topic := Filter}}}, Topic, BName, Acc) ->
|
||||||
do_get_matched_bridge_id(Topic, Filter, mqtt, BName, Acc).
|
do_get_matched_bridge_id(Topic, Filter, mqtt, BName, Acc);
|
||||||
|
get_matched_bridge_id(_BType, _Conf, _Topic, _BName, Acc) ->
|
||||||
|
Acc.
|
||||||
|
|
||||||
do_get_matched_bridge_id(Topic, Filter, BType, BName, Acc) ->
|
do_get_matched_bridge_id(Topic, Filter, BType, BName, Acc) ->
|
||||||
case emqx_topic:match(Topic, Filter) of
|
case emqx_topic:match(Topic, Filter) of
|
||||||
|
|
Loading…
Reference in New Issue