diff --git a/LeStorage/ApiCallCollection.swift b/LeStorage/ApiCallCollection.swift index 79806dd..64bd32f 100644 --- a/LeStorage/ApiCallCollection.swift +++ b/LeStorage/ApiCallCollection.swift @@ -226,12 +226,12 @@ actor ApiCallCollection: SomeCallCollection { /// Wait for an exponentionnaly long time depending on the number of attemps fileprivate func _wait() async { - #if DEBUG - let seconds = self._attemptLoops - #else - let delay = pow(2, self._attemptLoops) - let seconds = NSDecimalNumber(decimal: delay).intValue - #endif + var seconds = self._attemptLoops + if self._attemptLoops > 5 { + let delay = pow(2, self._attemptLoops - 2) // starts at 16s + seconds = NSDecimalNumber(decimal: delay).intValue + } + Logger.log("\(T.resourceName()): wait for \(seconds) sec") do { try await Task.sleep(until: .now + .seconds(seconds))