AshRateLimiter. BuiltinChanges
(ash_rate_limiter v2.0.1)
Copy Markdown
Change helpers to allow direct usage in mutation actions.
Summary
Functions
Add a rate-limit change directly to an action.
Types
@type rate_limit_options() :: [ limit: pos_integer(), per: pos_integer(), key: String.t() | AshRateLimiter.keyfun(), on: :before_action | :before_transaction ]
Functions
@spec rate_limit(rate_limit_options()) :: {AshRateLimiter.Change, rate_limit_options()}
Add a rate-limit change directly to an action.
Options
:limit(pos_integer/0) - Required. The maximum number of events allowed within the given scale:per(pos_integer/0) - Required. The time period (in milliseconds) for in which events are counted:key- The key used to identify the event. See the docs forAshRateLimiter.key_for_action/2for more. The default value is&AshRateLimiter.key_for_action/2.:on- The lifecycle hook to use for rate limiting.:before_actionruns inside the transaction;:before_transactionruns outside the transaction, after validations. Valid values are :before_action, :before_transaction The default value is:before_action.