docs: note that connector state must be immutable to avoid errors

This commit is contained in:
Thales Macedo Garitezi 2023-06-20 13:50:53 -03:00
parent ba96c725e5
commit ffce6fefa8
2 changed files with 5 additions and 0 deletions

View File

@ -141,6 +141,9 @@ connect(Opts0) ->
{Topic, MQTTConfig} = lists:nth(Index, TopicMappingList),
Config = #{
ack_retry_interval => AckRetryInterval,
%% Note: the `connector_state' value here must be immutable and not changed by the
%% bridge during `on_get_status', since we have handed it over to the pull
%% workers.
connector_state => ConnectorState,
hookpoint => Hookpoint,
instance_id => InstanceId,

View File

@ -69,6 +69,8 @@ on_stop(InstanceId, undefined = _State) ->
-spec on_get_status(resource_id(), state()) -> connected | disconnected.
on_get_status(InstanceId, _State) ->
%% Note: do *not* alter the `connector_state' value here. It must be immutable, since
%% we have handed it over to the pull workers.
case
emqx_resource_pool:health_check_workers(
InstanceId,