ARTRetrySequence

Objective-C


@interface ARTRetrySequence : NSObject

Swift

class RetrySequence : NSObject

Consider an operation which can fail. If we attempt to perform the operation and it fails, we may wish to start performing a sequence of retries, until success or some other termination condition is achieved. An ARTRetrySequence keeps track of the number of retries that have been attempted. Each time its addRetryAttempt method is called, it increments its retry count, and returns an ARTRetryAttempt which describes the duration that we should wait before performing the retry of the operation.

  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_UNAVAILABLE;
  • Creates a new retry sequence representing an operation which has not yet been retried.

    Parameters:

    • delayCalculator: The retry delay calculator used to calculate the duration after which each retry attempt should be performed.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDelayCalculator:
        (nonnull id<ARTRetryDelayCalculator>)delayCalculator;

    Swift

    init(delayCalculator: any RetryDelayCalculator)
  • id

    A unique identifier for this retry sequence, for logging purposes.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSUUID *_Nonnull id;

    Swift

    var id: UUID { get }
  • Informs the receiver that we intend to schedule another retry of the operation. Increments the sequence’s retry count and returns an ARTRetryAttempt object which describes how long we should wait before performing this retry.

    Declaration

    Objective-C

    - (nonnull ARTRetryAttempt *)addRetryAttempt;

    Swift

    func addRetryAttempt() -> RetryAttempt