Skip to content

Commit

Permalink
fix(datastore): Adding secureConnectionFailed as a retryable error (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh62 authored Jan 18, 2024
1 parent 417efad commit 3a47dd6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class RequestRetryablePolicy: RequestRetryable {
.dataNotAllowed,
.cannotParseResponse,
.networkConnectionLost,
.secureConnectionFailed,
.userAuthenticationRequired:
let waitMillis = retryDelayInMillseconds(for: attemptNumber)
return RequestRetryAdvice(shouldRetry: true, retryInterval: .milliseconds(waitMillis))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,17 @@ class RequestRetryablePolicyTests: XCTestCase {
XCTAssertEqual(retryAdvice.retryInterval, defaultTimeout)
}

func testSecureConnectionFailedError() {
let retryableErrorCode = URLError.init(.secureConnectionFailed)

let retryAdvice = retryPolicy.retryRequestAdvice(urlError: retryableErrorCode,
httpURLResponse: nil,
attemptNumber: 1)

XCTAssert(retryAdvice.shouldRetry)
assertMilliseconds(retryAdvice.retryInterval, greaterThan: 200, lessThan: 300)
}

func testMaxValueRetryDelay() {
let retryableErrorCode = URLError.init(.timedOut)

Expand Down

0 comments on commit 3a47dd6

Please sign in to comment.