RCNConfigSettings.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. /*
  2. * Copyright 2019 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "FirebaseRemoteConfig/Sources/Private/RCNConfigSettings.h"
  17. #import "FirebaseRemoteConfig/Sources/RCNConfigConstants.h"
  18. #import "FirebaseRemoteConfig/Sources/RCNConfigDBManager.h"
  19. #import "FirebaseRemoteConfig/Sources/RCNConfigValue_Internal.h"
  20. #import "FirebaseRemoteConfig/Sources/RCNDevice.h"
  21. #import "FirebaseRemoteConfig/Sources/RCNUserDefaultsManager.h"
  22. #import <GoogleUtilities/GULAppEnvironmentUtil.h>
  23. #import "FirebaseCore/Extension/FirebaseCoreInternal.h"
  24. static NSString *const kRCNGroupPrefix = @"frc.group.";
  25. static NSString *const kRCNUserDefaultsKeyNamelastETag = @"lastETag";
  26. static NSString *const kRCNUserDefaultsKeyNameLastSuccessfulFetchTime = @"lastSuccessfulFetchTime";
  27. static NSString *const kRCNAnalyticsFirstOpenTimePropertyName = @"_fot";
  28. static const int kRCNExponentialBackoffMinimumInterval = 60 * 2; // 2 mins.
  29. static const int kRCNExponentialBackoffMaximumInterval = 60 * 60 * 4; // 4 hours.
  30. @interface RCNConfigSettings () {
  31. /// A list of successful fetch timestamps in seconds.
  32. NSMutableArray *_successFetchTimes;
  33. /// A list of failed fetch timestamps in seconds.
  34. NSMutableArray *_failureFetchTimes;
  35. /// Device conditions since last successful fetch from the backend. Device conditions including
  36. /// app
  37. /// version, iOS version, device localte, language, GMP project ID and Game project ID. Used for
  38. /// determing whether to throttle.
  39. NSMutableDictionary *_deviceContext;
  40. /// Custom variables (aka App context digest). This is the pending custom variables request before
  41. /// fetching.
  42. NSMutableDictionary *_customVariables;
  43. /// Cached internal metadata from internal metadata table. It contains customized information such
  44. /// as HTTP connection timeout, HTTP read timeout, success/failure throttling rate and time
  45. /// interval. Client has the default value of each parameters, they are only saved in
  46. /// internalMetadata if they have been customize by developers.
  47. NSMutableDictionary *_internalMetadata;
  48. /// Last fetch status.
  49. FIRRemoteConfigFetchStatus _lastFetchStatus;
  50. /// Last fetch Error.
  51. FIRRemoteConfigError _lastFetchError;
  52. /// The time of last apply timestamp.
  53. NSTimeInterval _lastApplyTimeInterval;
  54. /// The time of last setDefaults timestamp.
  55. NSTimeInterval _lastSetDefaultsTimeInterval;
  56. /// The database manager.
  57. RCNConfigDBManager *_DBManager;
  58. // The namespace for this instance.
  59. NSString *_FIRNamespace;
  60. // The Google App ID of the configured FIRApp.
  61. NSString *_googleAppID;
  62. /// The user defaults manager scoped to this RC instance of FIRApp and namespace.
  63. RCNUserDefaultsManager *_userDefaultsManager;
  64. /// The timestamp of last eTag update.
  65. NSTimeInterval _lastETagUpdateTime;
  66. }
  67. @end
  68. @implementation RCNConfigSettings
  69. - (instancetype)initWithDatabaseManager:(RCNConfigDBManager *)manager
  70. namespace:(NSString *)FIRNamespace
  71. firebaseAppName:(NSString *)appName
  72. googleAppID:(NSString *)googleAppID {
  73. self = [super init];
  74. if (self) {
  75. _FIRNamespace = FIRNamespace;
  76. _googleAppID = googleAppID;
  77. _bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
  78. if (!_bundleIdentifier) {
  79. FIRLogNotice(kFIRLoggerRemoteConfig, @"I-RCN000038",
  80. @"Main bundle identifier is missing. Remote Config might not work properly.");
  81. _bundleIdentifier = @"";
  82. }
  83. _minimumFetchInterval = RCNDefaultMinimumFetchInterval;
  84. _deviceContext = [[NSMutableDictionary alloc] init];
  85. _customVariables = [[NSMutableDictionary alloc] init];
  86. _successFetchTimes = [[NSMutableArray alloc] init];
  87. _failureFetchTimes = [[NSMutableArray alloc] init];
  88. _DBManager = manager;
  89. _internalMetadata = [[_DBManager loadInternalMetadataTable] mutableCopy];
  90. if (!_internalMetadata) {
  91. _internalMetadata = [[NSMutableDictionary alloc] init];
  92. }
  93. _userDefaultsManager = [[RCNUserDefaultsManager alloc] initWithAppName:appName
  94. bundleID:_bundleIdentifier
  95. namespace:_FIRNamespace];
  96. // Check if the config database is new. If so, clear the configs saved in userDefaults.
  97. if ([_DBManager isNewDatabase]) {
  98. FIRLogNotice(kFIRLoggerRemoteConfig, @"I-RCN000072",
  99. @"New config database created. Resetting user defaults.");
  100. [_userDefaultsManager resetUserDefaults];
  101. }
  102. _isFetchInProgress = NO;
  103. }
  104. return self;
  105. }
  106. #pragma mark - read from / update userDefaults
  107. - (NSString *)lastETag {
  108. return [_userDefaultsManager lastETag];
  109. }
  110. - (void)setLastETag:(NSString *)lastETag {
  111. [self setLastETagUpdateTime:[[NSDate date] timeIntervalSince1970]];
  112. [_userDefaultsManager setLastETag:lastETag];
  113. }
  114. - (void)setLastETagUpdateTime:(NSTimeInterval)lastETagUpdateTime {
  115. [_userDefaultsManager setLastETagUpdateTime:lastETagUpdateTime];
  116. }
  117. - (NSTimeInterval)lastFetchTimeInterval {
  118. return _userDefaultsManager.lastFetchTime;
  119. }
  120. - (NSTimeInterval)lastETagUpdateTime {
  121. return _userDefaultsManager.lastETagUpdateTime;
  122. }
  123. // TODO: Update logic for app extensions as required.
  124. - (void)updateLastFetchTimeInterval:(NSTimeInterval)lastFetchTimeInterval {
  125. _userDefaultsManager.lastFetchTime = lastFetchTimeInterval;
  126. }
  127. #pragma mark - load from DB
  128. - (NSDictionary *)loadConfigFromMetadataTable {
  129. NSDictionary *metadata = [[_DBManager loadMetadataWithBundleIdentifier:_bundleIdentifier
  130. namespace:_FIRNamespace] copy];
  131. if (metadata) {
  132. // TODO: Remove (all metadata in general) once ready to
  133. // migrate to user defaults completely.
  134. if (metadata[RCNKeyDeviceContext]) {
  135. self->_deviceContext = [metadata[RCNKeyDeviceContext] mutableCopy];
  136. }
  137. if (metadata[RCNKeyAppContext]) {
  138. self->_customVariables = [metadata[RCNKeyAppContext] mutableCopy];
  139. }
  140. if (metadata[RCNKeySuccessFetchTime]) {
  141. self->_successFetchTimes = [metadata[RCNKeySuccessFetchTime] mutableCopy];
  142. }
  143. if (metadata[RCNKeyFailureFetchTime]) {
  144. self->_failureFetchTimes = [metadata[RCNKeyFailureFetchTime] mutableCopy];
  145. }
  146. if (metadata[RCNKeyLastFetchStatus]) {
  147. self->_lastFetchStatus =
  148. (FIRRemoteConfigFetchStatus)[metadata[RCNKeyLastFetchStatus] intValue];
  149. }
  150. if (metadata[RCNKeyLastFetchError]) {
  151. self->_lastFetchError = (FIRRemoteConfigError)[metadata[RCNKeyLastFetchError] intValue];
  152. }
  153. if (metadata[RCNKeyLastApplyTime]) {
  154. self->_lastApplyTimeInterval = [metadata[RCNKeyLastApplyTime] doubleValue];
  155. }
  156. if (metadata[RCNKeyLastFetchStatus]) {
  157. self->_lastSetDefaultsTimeInterval = [metadata[RCNKeyLastSetDefaultsTime] doubleValue];
  158. }
  159. }
  160. return metadata;
  161. }
  162. #pragma mark - update DB/cached
  163. // Update internal metadata content to cache and DB.
  164. - (void)updateInternalContentWithResponse:(NSDictionary *)response {
  165. // Remove all the keys with current pakcage name.
  166. [_DBManager deleteRecordWithBundleIdentifier:_bundleIdentifier
  167. namespace:_FIRNamespace
  168. isInternalDB:YES];
  169. for (NSString *key in _internalMetadata.allKeys) {
  170. if ([key hasPrefix:_bundleIdentifier]) {
  171. [_internalMetadata removeObjectForKey:key];
  172. }
  173. }
  174. for (NSString *entry in response) {
  175. NSData *val = [response[entry] dataUsingEncoding:NSUTF8StringEncoding];
  176. NSArray *values = @[ entry, val ];
  177. _internalMetadata[entry] = response[entry];
  178. [self updateInternalMetadataTableWithValues:values];
  179. }
  180. }
  181. - (void)updateInternalMetadataTableWithValues:(NSArray *)values {
  182. [_DBManager insertInternalMetadataTableWithValues:values completionHandler:nil];
  183. }
  184. /// If the last fetch was not successful, update the (exponential backoff) period that we wait until
  185. /// fetching again. Any subsequent fetch requests will be checked and allowed only if past this
  186. /// throttle end time.
  187. - (void)updateExponentialBackoffTime {
  188. // If not in exponential backoff mode, reset the retry interval.
  189. if (_lastFetchStatus == FIRRemoteConfigFetchStatusSuccess) {
  190. FIRLogDebug(kFIRLoggerRemoteConfig, @"I-RCN000057",
  191. @"Throttling: Entering exponential backoff mode.");
  192. _exponentialBackoffRetryInterval = kRCNExponentialBackoffMinimumInterval;
  193. } else {
  194. FIRLogDebug(kFIRLoggerRemoteConfig, @"I-RCN000057",
  195. @"Throttling: Updating throttling interval.");
  196. // Double the retry interval until we hit the truncated exponential backoff. More info here:
  197. // https://cloud.google.com/storage/docs/exponential-backoff
  198. _exponentialBackoffRetryInterval =
  199. ((_exponentialBackoffRetryInterval * 2) < kRCNExponentialBackoffMaximumInterval)
  200. ? _exponentialBackoffRetryInterval * 2
  201. : _exponentialBackoffRetryInterval;
  202. }
  203. // Randomize the next retry interval.
  204. int randomPlusMinusInterval = ((arc4random() % 2) == 0) ? -1 : 1;
  205. NSTimeInterval randomizedRetryInterval =
  206. _exponentialBackoffRetryInterval +
  207. (0.5 * _exponentialBackoffRetryInterval * randomPlusMinusInterval);
  208. _exponentialBackoffThrottleEndTime =
  209. [[NSDate date] timeIntervalSince1970] + randomizedRetryInterval;
  210. }
  211. - (void)updateMetadataWithFetchSuccessStatus:(BOOL)fetchSuccess {
  212. FIRLogDebug(kFIRLoggerRemoteConfig, @"I-RCN000056", @"Updating metadata with fetch result.");
  213. [self updateFetchTimeWithSuccessFetch:fetchSuccess];
  214. _lastFetchStatus =
  215. fetchSuccess ? FIRRemoteConfigFetchStatusSuccess : FIRRemoteConfigFetchStatusFailure;
  216. _lastFetchError = fetchSuccess ? FIRRemoteConfigErrorUnknown : FIRRemoteConfigErrorInternalError;
  217. if (fetchSuccess) {
  218. [self updateLastFetchTimeInterval:[[NSDate date] timeIntervalSince1970]];
  219. // Note: We expect the googleAppID to always be available.
  220. _deviceContext = FIRRemoteConfigDeviceContextWithProjectIdentifier(_googleAppID);
  221. }
  222. [self updateMetadataTable];
  223. }
  224. - (void)updateFetchTimeWithSuccessFetch:(BOOL)isSuccessfulFetch {
  225. NSTimeInterval epochTimeInterval = [[NSDate date] timeIntervalSince1970];
  226. if (isSuccessfulFetch) {
  227. [_successFetchTimes addObject:@(epochTimeInterval)];
  228. } else {
  229. [_failureFetchTimes addObject:@(epochTimeInterval)];
  230. }
  231. }
  232. - (void)updateMetadataTable {
  233. [_DBManager deleteRecordWithBundleIdentifier:_bundleIdentifier
  234. namespace:_FIRNamespace
  235. isInternalDB:NO];
  236. NSError *error;
  237. // Objects to be serialized cannot be invalid.
  238. if (!_bundleIdentifier) {
  239. return;
  240. }
  241. if (![NSJSONSerialization isValidJSONObject:_customVariables]) {
  242. FIRLogError(kFIRLoggerRemoteConfig, @"I-RCN000028",
  243. @"Invalid custom variables to be serialized.");
  244. return;
  245. }
  246. if (![NSJSONSerialization isValidJSONObject:_deviceContext]) {
  247. FIRLogError(kFIRLoggerRemoteConfig, @"I-RCN000029",
  248. @"Invalid device context to be serialized.");
  249. return;
  250. }
  251. if (![NSJSONSerialization isValidJSONObject:_successFetchTimes]) {
  252. FIRLogError(kFIRLoggerRemoteConfig, @"I-RCN000031",
  253. @"Invalid success fetch times to be serialized.");
  254. return;
  255. }
  256. if (![NSJSONSerialization isValidJSONObject:_failureFetchTimes]) {
  257. FIRLogError(kFIRLoggerRemoteConfig, @"I-RCN000032",
  258. @"Invalid failure fetch times to be serialized.");
  259. return;
  260. }
  261. NSData *serializedAppContext = [NSJSONSerialization dataWithJSONObject:_customVariables
  262. options:NSJSONWritingPrettyPrinted
  263. error:&error];
  264. NSData *serializedDeviceContext =
  265. [NSJSONSerialization dataWithJSONObject:_deviceContext
  266. options:NSJSONWritingPrettyPrinted
  267. error:&error];
  268. // The digestPerNamespace is not used and only meant for backwards DB compatibility.
  269. NSData *serializedDigestPerNamespace =
  270. [NSJSONSerialization dataWithJSONObject:@{} options:NSJSONWritingPrettyPrinted error:&error];
  271. NSData *serializedSuccessTime = [NSJSONSerialization dataWithJSONObject:_successFetchTimes
  272. options:NSJSONWritingPrettyPrinted
  273. error:&error];
  274. NSData *serializedFailureTime = [NSJSONSerialization dataWithJSONObject:_failureFetchTimes
  275. options:NSJSONWritingPrettyPrinted
  276. error:&error];
  277. if (!serializedDigestPerNamespace || !serializedDeviceContext || !serializedAppContext ||
  278. !serializedSuccessTime || !serializedFailureTime) {
  279. return;
  280. }
  281. NSDictionary *columnNameToValue = @{
  282. RCNKeyBundleIdentifier : _bundleIdentifier,
  283. RCNKeyNamespace : _FIRNamespace,
  284. RCNKeyFetchTime : @(self.lastFetchTimeInterval),
  285. RCNKeyDigestPerNamespace : serializedDigestPerNamespace,
  286. RCNKeyDeviceContext : serializedDeviceContext,
  287. RCNKeyAppContext : serializedAppContext,
  288. RCNKeySuccessFetchTime : serializedSuccessTime,
  289. RCNKeyFailureFetchTime : serializedFailureTime,
  290. RCNKeyLastFetchStatus : [NSString stringWithFormat:@"%ld", (long)_lastFetchStatus],
  291. RCNKeyLastFetchError : [NSString stringWithFormat:@"%ld", (long)_lastFetchError],
  292. RCNKeyLastApplyTime : @(_lastApplyTimeInterval),
  293. RCNKeyLastSetDefaultsTime : @(_lastSetDefaultsTimeInterval)
  294. };
  295. [_DBManager insertMetadataTableWithValues:columnNameToValue completionHandler:nil];
  296. }
  297. #pragma mark - fetch request
  298. /// Returns a fetch request with the latest device and config change.
  299. /// Whenever user issues a fetch api call, collect the latest request.
  300. - (NSString *)nextRequestWithUserProperties:(NSDictionary *)userProperties {
  301. // Note: We only set user properties as mentioned in the new REST API Design doc
  302. NSString *ret = [NSString stringWithFormat:@"{"];
  303. ret = [ret stringByAppendingString:[NSString stringWithFormat:@"app_instance_id:'%@'",
  304. _configInstallationsIdentifier]];
  305. ret = [ret stringByAppendingString:[NSString stringWithFormat:@", app_instance_id_token:'%@'",
  306. _configInstallationsToken]];
  307. ret = [ret stringByAppendingString:[NSString stringWithFormat:@", app_id:'%@'", _googleAppID]];
  308. ret = [ret stringByAppendingString:[NSString stringWithFormat:@", country_code:'%@'",
  309. FIRRemoteConfigDeviceCountry()]];
  310. ret = [ret stringByAppendingString:[NSString stringWithFormat:@", language_code:'%@'",
  311. FIRRemoteConfigDeviceLocale()]];
  312. ret = [ret
  313. stringByAppendingString:[NSString stringWithFormat:@", platform_version:'%@'",
  314. [GULAppEnvironmentUtil systemVersion]]];
  315. ret = [ret stringByAppendingString:[NSString stringWithFormat:@", time_zone:'%@'",
  316. FIRRemoteConfigTimezone()]];
  317. ret = [ret stringByAppendingString:[NSString stringWithFormat:@", package_name:'%@'",
  318. _bundleIdentifier]];
  319. ret = [ret stringByAppendingString:[NSString stringWithFormat:@", app_version:'%@'",
  320. FIRRemoteConfigAppVersion()]];
  321. ret = [ret stringByAppendingString:[NSString stringWithFormat:@", app_build:'%@'",
  322. FIRRemoteConfigAppBuildVersion()]];
  323. ret = [ret stringByAppendingString:[NSString stringWithFormat:@", sdk_version:'%@'",
  324. FIRRemoteConfigPodVersion()]];
  325. if (userProperties && userProperties.count > 0) {
  326. NSError *error;
  327. // Extract first open time from user properties and send as a separate field
  328. NSNumber *firstOpenTime = userProperties[kRCNAnalyticsFirstOpenTimePropertyName];
  329. NSMutableDictionary *remainingUserProperties = [userProperties mutableCopy];
  330. if (firstOpenTime != nil) {
  331. NSDate *date = [NSDate dateWithTimeIntervalSince1970:([firstOpenTime longValue] / 1000)];
  332. NSISO8601DateFormatter *formatter = [[NSISO8601DateFormatter alloc] init];
  333. NSString *firstOpenTimeISOString = [formatter stringFromDate:date];
  334. ret = [ret stringByAppendingString:[NSString stringWithFormat:@", first_open_time:'%@'",
  335. firstOpenTimeISOString]];
  336. [remainingUserProperties removeObjectForKey:kRCNAnalyticsFirstOpenTimePropertyName];
  337. }
  338. if (remainingUserProperties.count > 0) {
  339. NSData *jsonData = [NSJSONSerialization dataWithJSONObject:remainingUserProperties
  340. options:0
  341. error:&error];
  342. if (!error) {
  343. ret = [ret
  344. stringByAppendingString:[NSString
  345. stringWithFormat:@", analytics_user_properties:%@",
  346. [[NSString alloc]
  347. initWithData:jsonData
  348. encoding:NSUTF8StringEncoding]]];
  349. }
  350. }
  351. }
  352. ret = [ret stringByAppendingString:@"}"];
  353. return ret;
  354. }
  355. #pragma mark - getter/setter
  356. - (void)setLastFetchError:(FIRRemoteConfigError)lastFetchError {
  357. if (_lastFetchError != lastFetchError) {
  358. _lastFetchError = lastFetchError;
  359. [_DBManager updateMetadataWithOption:RCNUpdateOptionFetchStatus
  360. namespace:_FIRNamespace
  361. values:@[ @(_lastFetchStatus), @(_lastFetchError) ]
  362. completionHandler:nil];
  363. }
  364. }
  365. - (NSArray *)successFetchTimes {
  366. return [_successFetchTimes copy];
  367. }
  368. - (NSArray *)failureFetchTimes {
  369. return [_failureFetchTimes copy];
  370. }
  371. - (NSDictionary *)customVariables {
  372. return [_customVariables copy];
  373. }
  374. - (NSDictionary *)internalMetadata {
  375. return [_internalMetadata copy];
  376. }
  377. - (NSDictionary *)deviceContext {
  378. return [_deviceContext copy];
  379. }
  380. - (void)setCustomVariables:(NSDictionary *)customVariables {
  381. _customVariables = [[NSMutableDictionary alloc] initWithDictionary:customVariables];
  382. [self updateMetadataTable];
  383. }
  384. - (void)setMinimumFetchInterval:(NSTimeInterval)minimumFetchInterval {
  385. if (minimumFetchInterval < 0) {
  386. _minimumFetchInterval = 0;
  387. } else {
  388. _minimumFetchInterval = minimumFetchInterval;
  389. }
  390. }
  391. - (void)setFetchTimeout:(NSTimeInterval)fetchTimeout {
  392. if (fetchTimeout <= 0) {
  393. _fetchTimeout = RCNHTTPDefaultConnectionTimeout;
  394. } else {
  395. _fetchTimeout = fetchTimeout;
  396. }
  397. }
  398. - (void)setLastApplyTimeInterval:(NSTimeInterval)lastApplyTimestamp {
  399. _lastApplyTimeInterval = lastApplyTimestamp;
  400. [_DBManager updateMetadataWithOption:RCNUpdateOptionApplyTime
  401. namespace:_FIRNamespace
  402. values:@[ @(lastApplyTimestamp) ]
  403. completionHandler:nil];
  404. }
  405. - (void)setLastSetDefaultsTimeInterval:(NSTimeInterval)lastSetDefaultsTimestamp {
  406. _lastSetDefaultsTimeInterval = lastSetDefaultsTimestamp;
  407. [_DBManager updateMetadataWithOption:RCNUpdateOptionDefaultTime
  408. namespace:_FIRNamespace
  409. values:@[ @(lastSetDefaultsTimestamp) ]
  410. completionHandler:nil];
  411. }
  412. #pragma mark Throttling
  413. - (BOOL)hasMinimumFetchIntervalElapsed:(NSTimeInterval)minimumFetchInterval {
  414. if (self.lastFetchTimeInterval == 0) return YES;
  415. // Check if last config fetch is within minimum fetch interval in seconds.
  416. NSTimeInterval diffInSeconds = [[NSDate date] timeIntervalSince1970] - self.lastFetchTimeInterval;
  417. return diffInSeconds > minimumFetchInterval;
  418. }
  419. - (BOOL)shouldThrottle {
  420. NSTimeInterval now = [[NSDate date] timeIntervalSince1970];
  421. return ((self.lastFetchTimeInterval > 0) &&
  422. (_lastFetchStatus != FIRRemoteConfigFetchStatusSuccess) &&
  423. (_exponentialBackoffThrottleEndTime - now > 0));
  424. }
  425. @end