-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throttle api #184
base: master
Are you sure you want to change the base?
Throttle api #184
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #184 +/- ##
==========================================
+ Coverage 74.78% 75.65% +0.86%
==========================================
Files 31 31
Lines 1170 1224 +54
==========================================
+ Hits 875 926 +51
- Misses 295 298 +3 ☔ View full report in Codecov by Sentry. |
176d6b9
to
5f883d9
Compare
572f130
to
cbe472d
Compare
cbe472d
to
0bacea3
Compare
0bacea3
to
53cc8f8
Compare
6fdad6c
to
84bfb08
Compare
84bfb08
to
c16c3d6
Compare
src/throttle/amoc_throttle.erl
Outdated
step_size => pos_integer(), | ||
step_count => pos_integer(), | ||
duration => pos_integer()} | | ||
#{from_interarrival := interarrival(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems that from_interarrival
cannot be 0 nor infinity
in this case, the same is applicable to to_interarrival
src/throttle/amoc_throttle.erl
Outdated
interval => interval(), | ||
parallelism => non_neg_integer()} | ||
| #{interarrival := interarrival(), | ||
parallelism => non_neg_integer()}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the meaning of 0
%% @doc Sends and receives the given message `Msg'. | ||
%% | ||
%% Deprecated in favour of `wait/1' | ||
-spec send_and_wait(name(), any()) -> ok | {error, any()}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this interface is actively used by amoc_arsenal_xmpp. if it's so, please add tickets for amoc_arsena/amoc_arsenal_xmpp
src/throttle/amoc_throttle.erl
Outdated
-spec change_rate(name(), rate(), interval()) -> ok | {error, any()}. | ||
change_rate(Name, Rate, Interval) -> | ||
-spec change_rate(name(), throttle()) -> ok | {error, any()}. | ||
change_rate(Name, #{rate := Rate, interval := Interval}) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we want to support #{interarrival := interarrival()}
format here?
Amoc throttle allows to: | ||
|
||
- Setting the execution `Rate` per `Interval` | ||
- Limiting the number of parallel executions when `Rate` is set to `infinity` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rate
is supposed to be the number of parrallel executions if Interval
is 0
guides/throttle.md
Outdated
|
||
- Setting the execution `Rate` per `Interval` | ||
- Limiting the number of parallel executions when `Rate` is set to `infinity` | ||
- Setting the `Interarrival` time between actions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not different to execution rate, but just another form of setting it.
3de218e
to
d1efeaa
Compare
Making the API for throttle more friendly to use