Defines a retry strategy.
A retry strategy will be applied when an initial to attempt to open a session fails with a SessionEstablishmentTransientException, and can also be used to govern recovery attempts made by a PTDiffusionRecoverableUpdateStream.
The strategy is defined in terms of the number of milliseconds between retries and the maximum number of retries to attempt.
By default, every attempt waits the same, fixed interval. Supplying a PTDiffusionRetryBackoffCalculator allows this to be varied, for example to implement an exponential backoff, by calculating the interval for each attempt individually.
Class Methods | |
| (instancetype) | + NO_RETRY |
Properties | |
| NSUInteger | interval |
| NSInteger | attempts |
Instance Methods | |
| (instancetype) | - initWithInterval:andAttempts: |
| (instancetype) | - initWithInterval:andAttempts:backoff: |
| (NSUInteger) | - intervalForAttempt: |
| (instancetype) | - initWithInterval: |
| - (instancetype) initWithInterval: | (const NSUInteger) | interval |
Creates a new retry strategy that will retry indefinitely at the specified interval.
| interval | the number of milliseconds before the first retry and between subsequent retries |
| - (instancetype) initWithInterval: | (const NSUInteger) | interval | |
| andAttempts: | (const NSInteger) | attempts |
Creates a new retry strategy object.
| interval | the number of milliseconds before the first retry and between subsequent retries |
| attempts | the number of retry attempts |
| - (instancetype) initWithInterval: | (NSUInteger) | interval | |
| andAttempts: | (NSInteger) | attempts | |
| backoff: | (nullable PTDiffusionRetryBackoffCalculator) | backoff |
Creates a new retry strategy object that varies the interval between retries according to the given backoff calculator.
| interval | the base interval, in milliseconds, passed to backoff for it to calculate the actual interval to apply |
| attempts | the number of retry attempts |
| backoff | a block that calculates the interval, in milliseconds, to wait before making a given attempt. If nil, every attempt waits the fixed interval, equivalent to using initWithInterval:andAttempts:. |
| - (NSUInteger) intervalForAttempt: | (NSUInteger) | attempt |
Calculates the interval, in milliseconds, to wait before making the given retry attempt.
If this strategy was created without a PTDiffusionRetryBackoffCalculator, this always returns interval, regardless of the attempt number.
| attempt | the attempt number for which the interval is being calculated. The first attempt is 1. |
| + (instancetype) NO_RETRY |
The retry strategy that indicates that no retry is to be attempted.
|
readnonatomicassign |
The maximum number of retries to attempt
|
readnonatomicassign |
The number of milliseconds between retries