View Source Flamel.Retryable.Linear (flamel v1.10.0)

The linear retry strategy is a straightforward method for retrying failed requests by increasing the delay between retries in a linear fashion. This involves adding a fixed amount of time to the delay after each retry attempt.

Key Features:

  • Linear Increase: Delay between retries increases linearly.
  • Fixed Factor: A constant value used to increase the delay.
  • Simple Implementation: Easy to implement and configure.
  • Suitable for Low-Failure-Rate Systems: Effective when the failure rate is low and the system can tolerate small delays.

Example:

  • Initial Delay: 1 second
  • Factor: 2
Retry AttemptDelay
Retry 11 second
Retry 22 seconds
Retry 34 seconds
......

Advantages:

  • Simplicity: Easy to understand and implement.
  • Effectiveness: Works well for systems with a low failure rate.

Disadvantages:

  • High Failure Rates: May not be suitable for systems with high failure rates.
  • Excessive Delays: Can lead to long delays if the failure rate is high.
  • Latency Requirements: Not ideal for systems requiring strict latency controls.

Summary

Types

t()

Linear

Types

@type t() :: %Flamel.Retryable.Linear{
  assigns: map(),
  attempt: integer(),
  base: integer(),
  halt?: boolean(),
  interval: Flamel.Retryable.interval(),
  max_attempts: integer(),
  max_interval: Flamel.Retryable.interval(),
  reason: binary() | nil,
  with_jitter?: boolean()
}

Linear