Merge pull request #13001 from lafirest/fix/sysk_reconn

fix(sysk): fix that the syskeeper forwarding never reconnecting
This commit is contained in:
lafirest 2024-05-10 11:24:28 +08:00 committed by GitHub
commit da7b11020a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View File

@ -213,9 +213,9 @@ on_get_status(_InstanceId, #{pool_name := Pool, ack_timeout := AckTimeout}) ->
), ),
status_result(Health). status_result(Health).
status_result(true) -> connected; status_result(true) -> ?status_connected;
status_result(false) -> connecting; status_result(false) -> ?status_disconnected;
status_result({error, _}) -> connecting. status_result({error, _}) -> ?status_disconnected.
on_add_channel( on_add_channel(
_InstanceId, _InstanceId,
@ -251,7 +251,7 @@ on_get_channels(InstanceId) ->
on_get_channel_status(_InstanceId, ChannelId, #{channels := Channels}) -> on_get_channel_status(_InstanceId, ChannelId, #{channels := Channels}) ->
case maps:is_key(ChannelId, Channels) of case maps:is_key(ChannelId, Channels) of
true -> true ->
connected; ?status_connected;
_ -> _ ->
{error, not_exists} {error, not_exists}
end. end.

View File

@ -347,7 +347,7 @@ t_get_status(Config) ->
_Sleep = 500, _Sleep = 500,
_Attempts = 10, _Attempts = 10,
?assertMatch( ?assertMatch(
#{status := connecting}, #{status := disconnected},
emqx_bridge_v2:health_check(syskeeper_forwarder, ?SYSKEEPER_NAME) emqx_bridge_v2:health_check(syskeeper_forwarder, ?SYSKEEPER_NAME)
) )
). ).

View File

@ -0,0 +1 @@
Fixed an issue where the syskeeper forwarder would never reconnect when the connection was lost.