diff --git a/LeStorage/ApiCallCollection.swift b/LeStorage/ApiCallCollection.swift index 1886c64..519e7c4 100644 --- a/LeStorage/ApiCallCollection.swift +++ b/LeStorage/ApiCallCollection.swift @@ -199,7 +199,7 @@ actor ApiCallCollection: SomeCallCollection { if T.copyServerResponse { StoreCenter.main.updateLocalInstances(results) } - self._attemptLoops = -1 +// self._attemptLoops = -1 } } catch { Logger.error(error) @@ -217,8 +217,12 @@ actor ApiCallCollection: SomeCallCollection { /// Wait for an exponentionnaly long time depending on the number of attemps fileprivate func _wait() async { + #if DEBUG + let seconds = 2 * self._attemptLoops + #else let delay = pow(2, self._attemptLoops) let seconds = NSDecimalNumber(decimal: delay).intValue + #endif Logger.log("\(T.resourceName()): wait for \(seconds) sec") do { try await Task.sleep(until: .now + .seconds(seconds)) diff --git a/LeStorage/StoredCollection+Sync.swift b/LeStorage/StoredCollection+Sync.swift index a1e5bcc..fbd6200 100644 --- a/LeStorage/StoredCollection+Sync.swift +++ b/LeStorage/StoredCollection+Sync.swift @@ -276,7 +276,7 @@ extension StoredCollection: SomeSyncedCollection where T : SyncedStorable { if instance.lastUpdate > localInstance.lastUpdate { self.updateItem(instance, index: index) } else { - Logger.log("dont update: \(instance.lastUpdate.timeIntervalSince1970) / \(localInstance.lastUpdate.timeIntervalSince1970)") + Logger.log("do not update: \(instance.lastUpdate.timeIntervalSince1970) / local: \(localInstance.lastUpdate.timeIntervalSince1970)") } } else { // insert if shared {