Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/swiftuiux/retry-policy-service-example

Example for retry service provides policy for how often some operation should happen with the timeout limit
https://github.com/swiftuiux/retry-policy-service-example

retry retry-pattern retry-policy retry-strategies retrying-requests swift

Last synced: 16 days ago
JSON representation

Example for retry service provides policy for how often some operation should happen with the timeout limit

Awesome Lists containing this project

README

        

# Example for retry service provides policy for how often some operation should happen with the timeout limit and delay between events

The service creates sequence of the delays (nanoseconds) according to chosen strategy

There are two strategies
- constant - constant delay between retries
- exponential - Exponential backoff is a strategy in which you increase the delays between retries

```swift
/// Constant delay between retries
case constant(
retry : UInt = 5,
duration: DispatchTimeInterval = .seconds(2),
timeout: DispatchTimeInterval = .seconds(Int.max)
)

/// Exponential backoff is a strategy in which you increase the delays between retries
case exponential(
retry : UInt = 3,
multiplier: Double = 2.0, // The power exponent
duration: DispatchTimeInterval = .seconds(2),
timeout: DispatchTimeInterval = .seconds(Int.max)
)

```