فهرست منبع

chore: delete bad parse_bridge function clause

Zaiming (Stone) Shi 3 سال پیش
والد
کامیت
7b601bf970

+ 0 - 2
apps/emqx_bridge/src/emqx_bridge.erl

@@ -334,8 +334,6 @@ get_matched_bridges(Topic) ->
         Bridges
     ).
 
-%% TODO: refactor to return bridge type, and bridge name directly
-%% so there is no need to parse the id back to type and name at where it is used
 get_matched_bridge_id(_BType, #{enable := false}, _Topic, _BName, Acc) ->
     Acc;
 get_matched_bridge_id(BType, #{local_topic := Filter}, Topic, BName, Acc) when

+ 0 - 2
apps/emqx_bridge/src/emqx_bridge_resource.erl

@@ -71,8 +71,6 @@ bridge_id(BridgeType, BridgeName) ->
     Type = bin(BridgeType),
     <<Type/binary, ":", Name/binary>>.
 
-parse_bridge_id(<<"bridge:", BridgeId/binary>>) ->
-    parse_bridge_id(BridgeId);
 parse_bridge_id(BridgeId) ->
     case string:split(bin(BridgeId), ":", all) of
         [Type, Name] -> {binary_to_atom(Type, utf8), binary_to_atom(Name, utf8)};

+ 2 - 1
lib-ee/emqx_ee_bridge/test/emqx_bridge_impl_kafka_producer_SUITE.erl

@@ -383,7 +383,8 @@ config(Args) ->
         #{atom_key => true}
     ),
     InstId = maps:get("instance_id", Args),
-    Parsed#{bridge_name => erlang:element(2, emqx_bridge_resource:parse_bridge_id(InstId))}.
+    <<"bridge:", BridgeId>> = InstId,
+    Parsed#{bridge_name => erlang:element(2, emqx_bridge_resource:parse_bridge_id(BridgeId))}.
 
 hocon_config(Args) ->
     AuthConf = maps:get("authentication", Args),