File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -107,14 +107,22 @@ class AuthManager: IterableAuthManagerProtocol {
107
107
private func queueAuthTokenExpirationRefresh( _ authToken: String ? ) {
108
108
ITBInfo ( )
109
109
110
+ clearRefreshTimer ( )
111
+
110
112
guard let authToken = authToken, let expirationDate = AuthManager . decodeExpirationDateFromAuthToken ( authToken) else {
113
+ /// schedule a default timer of 10 seconds if we fall into this case
114
+ scheduleAuthTokenRefreshTimer ( 10 )
115
+
111
116
return
112
117
}
113
118
114
119
let timeIntervalToRefresh = TimeInterval ( expirationDate) - dateProvider. currentDate. timeIntervalSince1970 - expirationRefreshPeriod
115
120
116
- clearRefreshTimer ( )
117
- expirationRefreshTimer = Timer . scheduledTimer ( withTimeInterval: timeIntervalToRefresh, repeats: false ) { [ weak self] _ in
121
+ scheduleAuthTokenRefreshTimer ( timeIntervalToRefresh)
122
+ }
123
+
124
+ private func scheduleAuthTokenRefreshTimer( _ interval: TimeInterval ) {
125
+ expirationRefreshTimer = Timer . scheduledTimer ( withTimeInterval: interval, repeats: false ) { [ weak self] _ in
118
126
self ? . requestNewAuthToken ( hasFailedPriorAuth: false )
119
127
}
120
128
}
You can’t perform that action at this time.
0 commit comments