Skip to content

Commit

Permalink
Merge pull request #159 from esl/controller/deal_with_users_dying_too…
Browse files Browse the repository at this point in the history
…_fast

Handle stop request with already zero users
  • Loading branch information
arcusfelis authored Dec 1, 2023
2 parents d059df5 + f1f42c8 commit b4dd816
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/amoc_controller.erl
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ handle_start_scenario(_Scenario, _Settings, #state{status = Status} = State) ->
{{error, {invalid_status, Status}}, State}.

-spec handle_stop_scenario(state()) -> {handle_call_res(), state()}.
handle_stop_scenario(#state{scenario = Scenario, scenario_state = ScenarioState,
no_of_users = 0, status = running} = State) ->
amoc_scenario:terminate(Scenario, ScenarioState),
{ok, State#state{status = finished}};
handle_stop_scenario(#state{status = running} = State) ->
terminate_all_users(),
{ok, State#state{status = terminating}};
Expand Down

0 comments on commit b4dd816

Please sign in to comment.