Merge pull request #13562 from zhongwencool/fix-deactivate-alarm

fix: deactivate alarm before create resource
This commit is contained in:
zhongwencool 2024-08-02 12:08:27 +08:00 committed by GitHub
commit 8a33ef8576
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -125,6 +125,7 @@ create(Type, Name, Conf0, Opts) ->
TypeBin = bin(Type), TypeBin = bin(Type),
ResourceId = resource_id(Type, Name), ResourceId = resource_id(Type, Name),
Conf = Conf0#{connector_type => TypeBin, connector_name => Name}, Conf = Conf0#{connector_type => TypeBin, connector_name => Name},
_ = emqx_alarm:ensure_deactivated(ResourceId),
{ok, _Data} = emqx_resource:create_local( {ok, _Data} = emqx_resource:create_local(
ResourceId, ResourceId,
?CONNECTOR_RESOURCE_GROUP, ?CONNECTOR_RESOURCE_GROUP,
@ -132,7 +133,6 @@ create(Type, Name, Conf0, Opts) ->
parse_confs(TypeBin, Name, Conf), parse_confs(TypeBin, Name, Conf),
parse_opts(Conf, Opts) parse_opts(Conf, Opts)
), ),
_ = emqx_alarm:ensure_deactivated(ResourceId),
ok. ok.
update(ConnectorId, {OldConf, Conf}) -> update(ConnectorId, {OldConf, Conf}) ->