fix: deactivate alarm before create resource
This commit is contained in:
parent
51530588ef
commit
6c2033ecbf
|
@ -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}) ->
|
||||||
|
|
Loading…
Reference in New Issue