Skip to content

Commit

Permalink
Add label to onStartOfDelay
Browse files Browse the repository at this point in the history
finestructure committed Jul 19, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 4bb59cf commit 1c498e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/Retry/Retry.swift
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ public enum Retry {
lastError = "\(error)"
guard retriesLeft > 0 else { break }
let delay = backedOffDelay(baseDelay: delay, attempt: currentTry)
logger.onStartOfDelay(delay: Double(delay))
logger.onStartOfDelay(label: label, delay: Double(delay))
sleep(delay)
currentTry += 1
retriesLeft -= 1
@@ -55,7 +55,7 @@ public enum Retry {

public protocol RetryLogger {
func onStartOfRetry(label: String, attempt: Int)
func onStartOfDelay(delay: Double)
func onStartOfDelay(label: String, delay: Double)
}


@@ -66,7 +66,7 @@ public struct DefaultLogger: RetryLogger {
print("\(label) (attempt \(attempt))")
}

public func onStartOfDelay(delay: Double) {
public func onStartOfDelay(label: String, delay: Double) {
print("Retrying in \(delay) seconds ...")
}
}

0 comments on commit 1c498e8

Please sign in to comment.