Merge pull request #9150 from terry-xiaoyu/port_rule_metrics_fix_to_release_v43

fix: reset rule metrics crashed under certain conditions
This commit is contained in:
Xinyu Liu 2022-10-14 16:05:23 +08:00 committed by GitHub
commit 265fab8ccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -333,6 +333,8 @@ handle_call({create_rule_metrics, Id}, _From,
_ -> RuleSpeeds#{Id => #rule_speed{}}
end}};
handle_call({reset_speeds, _Id}, _From, State = #state{rule_speeds = undefined}) ->
{reply, ok, State};
handle_call({reset_speeds, Id}, _From, State = #state{rule_speeds = RuleSpeedMap}) ->
{reply, ok, State#state{rule_speeds = maps:put(Id, #rule_speed{}, RuleSpeedMap)}};