Call scheduling improvement

sync2
Laurent 9 months ago
parent 190528e964
commit d1091b926e
  1. 5
      LeStorage/ApiCallCollection.swift
  2. 4
      LeStorage/StoreCenter.swift

@ -161,6 +161,11 @@ actor ApiCallCollection<T: SyncedStorable>: SomeCallCollection {
}
}
func rescheduleImmediately() {
self._attemptLoops = -1
self.rescheduleApiCallsIfNecessary()
}
/// Reschedule API calls if necessary
func rescheduleApiCallsIfNecessary() {
if self.items.isNotEmpty && !self._isRescheduling {

@ -129,7 +129,7 @@ public class StoreCenter {
}
@objc fileprivate func _willEnterForegroundNotification() {
Logger.log("_willEnterForegroundNotification")
// Logger.log("_willEnterForegroundNotification")
self._launchSynchronization()
}
@ -464,7 +464,7 @@ public class StoreCenter {
let syncGetCollection: ApiCallCollection<GetSyncData> = try self.apiCallCollection()
if await syncGetCollection.hasPendingCalls() {
await syncGetCollection.rescheduleApiCallsIfNecessary()
await syncGetCollection.rescheduleImmediately()
} else {
let getSyncData = GetSyncData()
getSyncData.lastUpdate = lastSync

Loading…
Cancel
Save