fix: reset rule metrics crashed under certain conditions
This commit is contained in:
parent
373bd41170
commit
381c56d52f
|
@ -328,6 +328,8 @@ handle_call({create_rule_metrics, Id}, _From,
|
||||||
_ -> RuleSpeeds#{Id => #rule_speed{}}
|
_ -> RuleSpeeds#{Id => #rule_speed{}}
|
||||||
end}};
|
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}) ->
|
handle_call({reset_speeds, Id}, _From, State = #state{rule_speeds = RuleSpeedMap}) ->
|
||||||
{reply, ok, State#state{rule_speeds = maps:put(Id, #rule_speed{}, RuleSpeedMap)}};
|
{reply, ok, State#state{rule_speeds = maps:put(Id, #rule_speed{}, RuleSpeedMap)}};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue