diff options
| author | Jon Petersson <jon.petersson@kvadrat.se> | 2023-08-11 16:26:48 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2023-08-28 17:16:06 +0200 |
| commit | bbb542e202b70bf921b050e6022cabb067988410 (patch) | |
| tree | 28f702fb3f710364d45048ea57c2b66ca935d9dd /ios/MullvadVPN/AddressCacheTracker | |
| parent | 6fd0f1213ce886b149516ed0d0a722988f77b277 (diff) | |
| download | mullvadvpn-bbb542e202b70bf921b050e6022cabb067988410.tar.xz mullvadvpn-bbb542e202b70bf921b050e6022cabb067988410.zip | |
Introduce Duration type that mimicks native iOS16 Duration
Diffstat (limited to 'ios/MullvadVPN/AddressCacheTracker')
| -rw-r--r-- | ios/MullvadVPN/AddressCacheTracker/AddressCacheTracker.swift | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ios/MullvadVPN/AddressCacheTracker/AddressCacheTracker.swift b/ios/MullvadVPN/AddressCacheTracker/AddressCacheTracker.swift index 9b9621010f..8c1dc2b258 100644 --- a/ios/MullvadVPN/AddressCacheTracker/AddressCacheTracker.swift +++ b/ios/MullvadVPN/AddressCacheTracker/AddressCacheTracker.swift @@ -13,11 +13,11 @@ import Operations import UIKit final class AddressCacheTracker { - /// Update interval (in seconds). - private static let updateInterval: TimeInterval = 60 * 60 * 24 + /// Update interval. + private static let updateInterval: Duration = .days(1) - /// Retry interval (in seconds). - private static let retryInterval: TimeInterval = 60 * 15 + /// Retry interval. + private static let retryInterval: Duration = .minutes(15) /// Logger. private let logger = Logger(label: "AddressCache.Tracker") @@ -174,11 +174,11 @@ final class AddressCacheTracker { private func _nextScheduleDate() -> Date { let nextDate = lastFailureAttemptDate.map { date in Date( - timeInterval: Self.retryInterval, + timeInterval: Self.retryInterval.timeInterval, since: date ) } ?? Date( - timeInterval: Self.updateInterval, + timeInterval: Self.updateInterval.timeInterval, since: store.getLastUpdateDate() ) |
