View Source NervesHubLink.Backoff (nerves_hub_link v1.2.0)

Compute retry backoff intervals used by Slipstream

Link to this section Summary

Functions

Produce a list of integer backoff delays with jitter

Link to this section Functions

Link to this function

delay_list(min, max, jitter)

View Source
@spec delay_list(integer(), integer(), number()) :: [integer()]

Produce a list of integer backoff delays with jitter

The first two parameters are minimum and maximum value. These are expected to be milliseconds, but this function doesn't care. The returned list will start with the minimum value and then double it until it reaches the maximum value.

The third parameter is the amount of jitter to add to each delay. The value should be between 0 and 1. Zero adds no jitter. A value like 0.25 will add up to 25% of the delay amount.