-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Feature Summary
Refactor the RetryStrategy enum to unify exponential and exponentialWithJitter into a single, more flexible exponential case. This will be achieved by making jitter and maximum interval optional parameters.
Motivation
Currently, exponential and exponentialWithJitter exist as separate cases. This leads to:
- Redundancy: Both cases share similar parameters (retry, multiplier, duration).
- Rigidity: If a user wants to use a basic exponential backoff but add a maxInterval, they are forced to use the exponentialWithJitter case even if they don't want jitter.
- API Bloat: Having two distinct cases for essentially the same mathematical progression makes the library harder to navigate.
Proposed Solution
Consolidate the cases into one. The new exponential case will include optional jitter and maxInterval parameters with sensible defaults.
case exponential(
retry: Int,
multiplier: Double = 2.0,
duration: DispatchTimeInterval,
jitter: Double? = nil,
maxInterval: DispatchTimeInterval? = nil
)Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers