fix: fallback action not triggered when send to webhook failed
This commit is contained in:
parent
7a3941ce5d
commit
0a99e835e7
|
@ -175,7 +175,8 @@ on_action_republish(_Selected, Envs = #{
|
||||||
}) ->
|
}) ->
|
||||||
?LOG(error, "[republish] recursively republish detected, msg topic: ~p, target topic: ~p",
|
?LOG(error, "[republish] recursively republish detected, msg topic: ~p, target topic: ~p",
|
||||||
[Topic, ?bound_v('TargetTopic', Envs)]),
|
[Topic, ?bound_v('TargetTopic', Envs)]),
|
||||||
emqx_rule_metrics:inc_actions_error(?bound_v('Id', Envs));
|
emqx_rule_metrics:inc_actions_error(?bound_v('Id', Envs)),
|
||||||
|
{badact, recursively_republish};
|
||||||
|
|
||||||
on_action_republish(Selected, _Envs = #{
|
on_action_republish(Selected, _Envs = #{
|
||||||
qos := QoS, flags := Flags, timestamp := Timestamp,
|
qos := QoS, flags := Flags, timestamp := Timestamp,
|
||||||
|
|
|
@ -268,13 +268,16 @@ on_action_data_to_webserver(Selected, _Envs =
|
||||||
emqx_rule_metrics:inc_actions_success(Id);
|
emqx_rule_metrics:inc_actions_success(Id);
|
||||||
{ok, StatusCode, _} ->
|
{ok, StatusCode, _} ->
|
||||||
?LOG(warning, "HTTP request failed with path: ~p status code: ~p", [NPath, StatusCode]),
|
?LOG(warning, "HTTP request failed with path: ~p status code: ~p", [NPath, StatusCode]),
|
||||||
emqx_rule_metrics:inc_actions_error(Id);
|
emqx_rule_metrics:inc_actions_error(Id),
|
||||||
|
{badact, StatusCode};
|
||||||
{ok, StatusCode, _, _} ->
|
{ok, StatusCode, _, _} ->
|
||||||
?LOG(warning, "HTTP request failed with path: ~p status code: ~p", [NPath, StatusCode]),
|
?LOG(warning, "HTTP request failed with path: ~p status code: ~p", [NPath, StatusCode]),
|
||||||
emqx_rule_metrics:inc_actions_error(Id);
|
emqx_rule_metrics:inc_actions_error(Id),
|
||||||
|
{badact, StatusCode};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?LOG(error, "HTTP request failed path: ~p error: ~p", [NPath, Reason]),
|
?LOG(error, "HTTP request failed path: ~p error: ~p", [NPath, Reason]),
|
||||||
emqx_rule_metrics:inc_actions_error(Id)
|
emqx_rule_metrics:inc_actions_error(Id),
|
||||||
|
{badact, Reason}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
format_msg([], Data) ->
|
format_msg([], Data) ->
|
||||||
|
|
Loading…
Reference in New Issue