func shouldRetryRequest()

in AWSAppSyncClient/Internal/AWSAppSyncRetryHandler.swift [40:57]


    func shouldRetryRequest(for error: ConnectionProviderError) -> RetryAdvice {
        currentAttemptNumber += 1
        switch error {
        case .connection, .limitExceeded:
            // If using aggressive retry strategy, we attempt a maximum 12 times.
            if self.retryStrategy == .aggressive &&
                currentAttemptNumber > AWSAppSyncRetryHandler.maxRetryAttemptsWhenUsingAggresiveMode {
                return AWSAppSyncRetryAdvice(shouldRetry: false, retryInterval: nil)
            }
            let waitMillis = AWSAppSyncRetryHandler.retryDelayInMillseconds(for: currentAttemptNumber, retryStrategy: retryStrategy)
            if waitMillis < AWSAppSyncRetryHandler.maxWaitMilliseconds {
                return AWSAppSyncRetryAdvice(shouldRetry: true, retryInterval: .milliseconds(waitMillis))
            }
        default:
            return AWSAppSyncRetryAdvice(shouldRetry: false, retryInterval: nil)
        }
        return AWSAppSyncRetryAdvice(shouldRetry: false, retryInterval: nil)
    }