Skip to content

Commit acfdabc

Browse files
committed
Review
1 parent 8886183 commit acfdabc

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

guides/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Amoc supports the following generic configuration parameters:
99
* default value - empty list (`[]`)
1010
* example: `AMOC_NODES="['amoc@amoc-1', 'amoc@amoc-2']"`
1111

12-
* `user_rate` - a rate (in ms, implemented as a `t:amoc_throttle:rate/0`) of user processes per minute:
12+
* `user_rate` - a rate (implemented as a `t:amoc_throttle:rate/0`) of user processes per minute:
1313
* default value - 1200.
1414
* example: `AMOC_USER_RATE="600"`
1515
* this parameter can be updated at runtime (in the same way as scenario configuration).

src/amoc_controller.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
-required_variable(#{name => user_rate, default_value => ?DEFAULT_USER_RATE,
1414
verification => {?MODULE, verify_user_rate, 1},
15-
description => "Throttle rate for the Scenario:start/1,2 callback (def: 50ms)",
15+
description => "Throttle rate for the Scenario:start/1,2 callback",
1616
update => {?MODULE, update_user_rate, 2}}).
1717

1818
-record(state, {scenario :: amoc:scenario() | undefined,
@@ -130,9 +130,9 @@ disable() ->
130130
%% @private
131131
-spec verify_user_rate(any()) -> boolean().
132132
verify_user_rate(UserRate) ->
133-
infinity =:= UserRate
133+
(infinity =:= UserRate)
134134
orelse is_integer(UserRate)
135-
andalso 0 =< UserRate.
135+
andalso (0 =< UserRate).
136136

137137
%% @private
138138
-spec update_user_rate(user_rate, user_rate()) -> ok.

src/throttle/amoc_throttle_controller.erl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
ensure_throttle_processes_started/2,
1212
pause/1, resume/1, stop/1, get_info/1,
1313
change_rate/2, change_rate_gradually/2,
14-
pg_scope/0, consume_all_messages/1,
14+
pg_scope/0, consume_all_timer_ticks/1,
1515
get_throttle_process/1,
1616
raise_event_on_slave_node/2, telemetry_event/2]).
1717

@@ -260,17 +260,17 @@ continue_plan(Name, State, Info, #change_rate_plan{rates = [Rate]} = Plan) ->
260260
TRef = Plan#change_rate_plan.timer,
261261
Info1 = do_change_rate(Name, Rate, Interval, Info),
262262
{ok, cancel} = timer:cancel(TRef),
263-
consume_all_messages({change_plan, Name}),
263+
consume_all_timer_ticks({change_plan, Name}),
264264
State#{Name => Info1#throttle_info{change_plan = undefined}};
265265
continue_plan(Name, State, Info, #change_rate_plan{rates = [Rate | Rates]} = Plan) ->
266266
Info1 = do_change_rate(Name, Rate, Info#throttle_info.interval, Info),
267267
NewPlan = Plan#change_rate_plan{rates = Rates},
268268
State#{Name => Info1#throttle_info{change_plan = NewPlan}}.
269269

270-
-spec consume_all_messages(any()) -> ok.
271-
consume_all_messages(Msg) ->
270+
-spec consume_all_timer_ticks(any()) -> ok.
271+
consume_all_timer_ticks(Msg) ->
272272
receive
273-
Msg -> consume_all_messages(Msg)
273+
Msg -> consume_all_timer_ticks(Msg)
274274
after 0 -> ok
275275
end.
276276

src/throttle/amoc_throttle_process.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ maybe_stop_timer(#state{tref = undefined}) ->
143143
ok;
144144
maybe_stop_timer(#state{tref = TRef}) ->
145145
{ok, cancel} = timer:cancel(TRef),
146-
amoc_throttle_controller:consume_all_messages(delay_between_executions).
146+
amoc_throttle_controller:consume_all_timer_ticks(delay_between_executions).
147147

148148
timeout(#state{delay_between_executions = infinity}) ->
149149
infinity;

0 commit comments

Comments
 (0)