fix: check channel id exist when get_channel_status

This commit is contained in:
zhongwencool 2024-02-20 09:38:33 +08:00
parent fd13a661cf
commit 2561ff94ec
1 changed files with 7 additions and 4 deletions

View File

@ -179,11 +179,14 @@ on_remove_channel(
{ok, NewState}.
on_get_channel_status(
_ResId,
_ChannelId,
_State
InstanceId,
ChannelId,
#{installed_channels := Channels} = State
) ->
?status_connected.
case maps:find(ChannelId, Channels) of
{ok, _} -> on_get_status(InstanceId, State);
error -> ?status_disconnected
end.
on_get_channels(ResId) ->
emqx_bridge_v2:get_channels_for_connector(ResId).