Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/swiftuiux/retry-policy-service-example
- Owner: swiftuiux
- License: mit
- Created: 2023-03-07T07:40:18.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-23T16:54:28.000Z (5 months ago)
- Last Synced: 2024-11-28T18:41:36.529Z (24 days ago)
- Topics: retry, retry-pattern, retry-policy, retry-strategies, retrying-requests, swift
- Language: Swift
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)
)```