# `LiveLoad.Scenario.Throttle.Interarrival`
[🔗](https://github.com/probably-not/live-load/blob/v0.1.1/lib/live_load/scenario/throttle/interarrival.ex#L1)

`LiveLoad.Scenario.Throttle.Interarrival` provides a rate limiter which enforces a set amount of time between events.

## Examples

```elixir
# One event every 500 milliseconds
LiveLoad.Scenario.Throttle.Interarrival.new(:my_throttle, to_timeout(millisecond: 500))

# One event every 2 seconds
LiveLoad.Scenario.Throttle.Interarrival.new(:my_throttle, to_timeout(second: 2))

# Start at 1 event per second and ramp up over the next 2 minutes
LiveLoad.Scenario.Throttle.Interarrival.new(:my_throttle, to_timeout(second: 1))
|> LiveLoad.Scenario.Throttle.Interarrival.ramp(100, duration: to_timeout(minute: 2))
```

# `t`

```elixir
@opaque t()
```

# `time_between`

```elixir
@type time_between() :: pos_integer()
```

# `new`

```elixir
@spec new(name :: atom(), time_between :: time_between()) :: t()
```

Creates a new `LiveLoad.Scenario.Throttle.Interarrival` with the given name and time between events.

# `ramp`

```elixir
@spec ramp(
  interarrival :: t(),
  target :: LiveLoad.Scenario.Throttle.Ramp.target(),
  ramp_opts :: [LiveLoad.Scenario.Throttle.Ramp.option()]
) :: t()
```

Attaches a gradually ramping interarrival change to the throttle.

Target defines the target interarrival in milliseconds.

## Options

  * `:duration`: The duration of the gradual ramp up in milliseconds
  * `:steps`: The number of steps to take while ramping up. Requires an `:interval` value.
  * `:interval`: The interval at which to take each step. Requires a `:step` value.

