refactor(rule_engine_metrics): refactor code_change
This commit is contained in:
parent
7605fa5e64
commit
de58c8e7bc
|
@ -324,14 +324,11 @@ handle_info(ticking, State = #state{rule_speeds = RuleSpeeds0}) ->
|
|||
handle_info(_Info, State) ->
|
||||
{noreply, State}.
|
||||
|
||||
code_change({down, _Vsn}, State = #state{metric_ids = MIDs}, [Vsn])
|
||||
when Vsn =:= "4.3.0";
|
||||
Vsn =:= "4.3.1";
|
||||
Vsn =:= "4.3.2";
|
||||
Vsn =:= "4.3.3";
|
||||
Vsn =:= "4.3.4";
|
||||
Vsn =:= "4.3.5";
|
||||
Vsn =:= "4.3.6" ->
|
||||
code_change({down, _Vsn}, State = #state{metric_ids = MIDs}, [Vsn]) ->
|
||||
case string:tokens(Vsn, ".") of
|
||||
["4", "3", Val] ->
|
||||
case string:to_integer(Val) =< 7 of
|
||||
true ->
|
||||
[begin
|
||||
Passed = get_rules_passed(Id),
|
||||
Take = get_actions_taken(Id),
|
||||
|
@ -349,15 +346,16 @@ code_change({down, _Vsn}, State = #state{metric_ids = MIDs}, [Vsn])
|
|||
inc_actions_retry(Id, Retry)
|
||||
end || Id <- sets:to_list(MIDs)],
|
||||
{ok, State};
|
||||
false -> {ok, State}
|
||||
end;
|
||||
_ -> {ok, State}
|
||||
end;
|
||||
|
||||
code_change(_Vsn, State = #state{metric_ids = MIDs}, [Vsn])
|
||||
when Vsn =:= "4.3.0";
|
||||
Vsn =:= "4.3.1";
|
||||
Vsn =:= "4.3.2";
|
||||
Vsn =:= "4.3.3";
|
||||
Vsn =:= "4.3.4";
|
||||
Vsn =:= "4.3.5";
|
||||
Vsn =:= "4.3.6" ->
|
||||
code_change(_Vsn, State = #state{metric_ids = MIDs}, [Vsn]) ->
|
||||
case string:tokens(Vsn, ".") of
|
||||
["4", "3", Val] ->
|
||||
case string:to_integer(Val) =< 7 of
|
||||
true ->
|
||||
[begin
|
||||
Matched = get_rules_matched(Id),
|
||||
Take = get_actions_taken(Id),
|
||||
|
@ -376,6 +374,10 @@ code_change(_Vsn, State = #state{metric_ids = MIDs}, [Vsn])
|
|||
inc_actions_retry(Id, Retry)
|
||||
end || Id <- sets:to_list(MIDs)],
|
||||
{ok, State};
|
||||
false -> {ok, State}
|
||||
end;
|
||||
_ -> {ok, State}
|
||||
end;
|
||||
|
||||
code_change(_OldVsn, State, _Extra) ->
|
||||
{ok, State}.
|
||||
|
|
Loading…
Reference in New Issue