Skip to content

Commit d2ff8da

Browse files
committed
♻️ Rename RetryStrategy to RetryDecision.
1 parent ef8ec3f commit d2ff8da

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Sources/HTTPNetworking/Plugins/HTTPRequestRetrier.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ public protocol HTTPRequestRetrier {
1313
with response: HTTPURLResponse?,
1414
dueTo error: Error,
1515
previousAttempts: Int
16-
) async throws -> RetryStrategy
16+
) async throws -> RetryDecision
1717
}
1818

19-
// MARK: - RetryStrategy
19+
// MARK: - RetryDecision
2020

2121
/// A strategy that indicates to an ``HTTPRequest`` what approach should be taken when
2222
/// attempting to retry upon failure.
23-
public enum RetryStrategy {
23+
public enum RetryDecision {
2424
/// Indicates that a failing request should not be retried.
2525
case concede
2626
/// Indicates that a failing request should be reattempted.

Sources/HTTPNetworking/Plugins/Retriers/Retrier.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public typealias RetryHandler = (
88
_ response: HTTPURLResponse?,
99
_ error: Error,
1010
_ previousAttempts: Int
11-
) async throws -> RetryStrategy
11+
) async throws -> RetryDecision
1212

1313
// MARK: - Retrier
1414

@@ -37,7 +37,7 @@ public struct Retrier: HTTPRequestRetrier {
3737
with response: HTTPURLResponse?,
3838
dueTo error: Error,
3939
previousAttempts: Int
40-
) async throws -> RetryStrategy {
40+
) async throws -> RetryDecision {
4141
try await handler(request, session, response, error, previousAttempts)
4242
}
4343
}

Sources/HTTPNetworking/Plugins/Retriers/ZipRetrier.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public struct ZipRetrier: HTTPRequestRetrier {
3434
with response: HTTPURLResponse?,
3535
dueTo error: Error,
3636
previousAttempts: Int
37-
) async throws -> RetryStrategy {
37+
) async throws -> RetryDecision {
3838
for retrier in retriers {
3939
try Task.checkCancellation()
4040

Tests/HTTPNetworkingTests/HTTPRequestTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ class HTTPRequestTests: XCTestCase {
11041104
let retrierThreeExpectation = expectation(description: "Expected retrier three to retry.")
11051105
let retrierFourExpectation = expectation(description: "Expected retrier four to retry.")
11061106

1107-
let block: (Int, Int, XCTestExpectation) -> RetryStrategy = { previousAttempts, expectedPreviousAttempts, expectation in
1107+
let block: (Int, Int, XCTestExpectation) -> RetryDecision = { previousAttempts, expectedPreviousAttempts, expectation in
11081108
if previousAttempts == expectedPreviousAttempts {
11091109
expectation.fulfill()
11101110
return .retry

Tests/HTTPNetworkingTests/Plugins/Retriers/ZipRetrierTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ZipRetrierTests: XCTestCase {
1111
with response: HTTPURLResponse?,
1212
dueTo error: Error,
1313
previousAttempts: Int
14-
) async -> HTTPNetworking.RetryStrategy {
14+
) async -> HTTPNetworking.RetryDecision {
1515
.concede
1616
}
1717
}

0 commit comments

Comments
 (0)