Skip to content

Commit d67a1f1

Browse files
committed
use nonisolated(nonsending)
1 parent 0d21f31 commit d67a1f1

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

Evolution/NNNN-retry-backoff.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ This proposal introduces a retry function that executes an asynchronous operatio
2323

2424
```swift
2525
@available(iOS 16.0, macCatalyst 16.0, macOS 13.0, tvOS 16.0, visionOS 1.0, watchOS 9.0, *)
26-
public func retry<Result, ErrorType, ClockType>(
26+
nonisolated(nonsending) public func retry<Result, ErrorType, ClockType>(
2727
maxAttempts: Int,
2828
tolerance: ClockType.Instant.Duration? = nil,
2929
clock: ClockType = ContinuousClock(),
30-
isolation: isolated (any Actor)? = #isolation,
3130
operation: () async throws(ErrorType) -> Result,
3231
strategy: (ErrorType) -> RetryAction<ClockType.Instant.Duration> = { _ in .backoff(.zero) }
3332
) async throws -> Result where ClockType: Clock, ErrorType: Error

Sources/AsyncAlgorithms/Retry/Retry.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,10 @@ public struct RetryAction<Duration: DurationProtocol> {
7575
/// }
7676
/// ```
7777
@available(iOS 16.0, macCatalyst 16.0, macOS 13.0, tvOS 16.0, visionOS 1.0, watchOS 9.0, *)
78-
@inlinable public func retry<Result, ErrorType, ClockType>(
78+
@inlinable nonisolated(nonsending) public func retry<Result, ErrorType, ClockType>(
7979
maxAttempts: Int,
8080
tolerance: ClockType.Instant.Duration? = nil,
8181
clock: ClockType,
82-
isolation: isolated (any Actor)? = #isolation,
8382
operation: () async throws(ErrorType) -> Result,
8483
strategy: (ErrorType) -> RetryAction<ClockType.Instant.Duration> = { _ in .backoff(.zero) }
8584
) async throws -> Result where ClockType: Clock, ErrorType: Error {
@@ -151,10 +150,9 @@ public struct RetryAction<Duration: DurationProtocol> {
151150
/// }
152151
/// ```
153152
@available(iOS 16.0, macCatalyst 16.0, macOS 13.0, tvOS 16.0, visionOS 1.0, watchOS 9.0, *)
154-
@inlinable public func retry<Result, ErrorType>(
153+
@inlinable nonisolated(nonsending) public func retry<Result, ErrorType>(
155154
maxAttempts: Int,
156155
tolerance: ContinuousClock.Instant.Duration? = nil,
157-
isolation: isolated (any Actor)? = #isolation,
158156
operation: () async throws(ErrorType) -> Result,
159157
strategy: (ErrorType) -> RetryAction<ContinuousClock.Instant.Duration> = { _ in .backoff(.zero) }
160158
) async throws -> Result where ErrorType: Error {

Tests/AsyncAlgorithmsTests/TestBackoff.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Testing
55

66
@available(iOS 16.0, macCatalyst 16.0, macOS 13.0, tvOS 16.0, visionOS 1.0, watchOS 9.0, *)
77
@Test func constantBackoff() {
8-
var strategy = Backoff.constant(Duration.milliseconds(5))
8+
var strategy = Backoff.constant(.milliseconds(5))
99
#expect(strategy.nextDuration() == .milliseconds(5))
1010
#expect(strategy.nextDuration() == .milliseconds(5))
1111
}

0 commit comments

Comments
 (0)