Skip to content

Commit

Permalink
Make the RetryHelper methods mutating
Browse files Browse the repository at this point in the history
  • Loading branch information
Frizlab committed Jan 12, 2023
1 parent 123eafb commit c64f989
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/RetryingOperation/RetryHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Foundation

public protocol RetryHelper {

func setup()
func teardown()
mutating func setup()
mutating func teardown()

}
4 changes: 2 additions & 2 deletions Sources/RetryingOperation/RetryingOperation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ open class RetryingOperation : Operation {
private var nRetries = 0

private var retryHelpers: [RetryHelper]? {
willSet {retryHelpers?.forEach{ $0.teardown() }}
didSet {retryHelpers?.forEach{ $0.setup() }}
willSet {retryHelpers?.forEach{ var mut = $0; mut.teardown() }}
didSet {retryHelpers = retryHelpers?.map{ var ret = $0; ret.setup(); return ret }}
}

private let retryStateSemaphore = DispatchSemaphore(value: 1)
Expand Down

0 comments on commit c64f989

Please sign in to comment.