Skip to content

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

License

Notifications You must be signed in to change notification settings

igor11191708/retry-policy-service-example

Repository files navigation

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
        /// 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)
        )

Packages using the package

Async http client

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages