Skip to content

Commit be2729a

Browse files
authored
Block calls to get config until DB load completes (#7975)
* Block calls to get config until DB load completes * Add changelog * Add TODO for refactoring
1 parent 41d2c8c commit be2729a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

FirebaseRemoteConfig/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Unreleased
22
- [fixed] Fixed throttling issue when fetch fails due to no network. (#6628)
3+
- [fixed] Fixed issue where sometimes the local config returned is empty. (#7424)
34

45
# v7.10.0
56
- [changed] Throw exception if projectID is missing from FirebaseOptions. (#7725)

FirebaseRemoteConfig/Sources/RCNConfigContent.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ - (instancetype)initWithDBManager:(RCNConfigDBManager *)DBManager {
8686
_bundleIdentifier = @"";
8787
}
8888
_DBManager = DBManager;
89-
// Waits for both config and Personalization data to load.
90-
_configLoadFromDBSemaphore = dispatch_semaphore_create(1);
89+
_configLoadFromDBSemaphore = dispatch_semaphore_create(0);
9190
[self loadConfigFromMainTable];
9291
}
9392
return self;
@@ -123,12 +122,12 @@ - (void)loadConfigFromMainTable {
123122
dispatch_semaphore_signal(self->_configLoadFromDBSemaphore);
124123
}];
125124

125+
// TODO(karenzeng): Refactor personalization to be returned in loadMainWithBundleIdentifier above
126126
[_DBManager loadPersonalizationWithCompletionHandler:^(
127127
BOOL success, NSDictionary *fetchedPersonalization,
128128
NSDictionary *activePersonalization, NSDictionary *defaultConfig) {
129129
self->_fetchedPersonalization = [fetchedPersonalization copy];
130130
self->_activePersonalization = [activePersonalization copy];
131-
dispatch_semaphore_signal(self->_configLoadFromDBSemaphore);
132131
}];
133132
}
134133

0 commit comments

Comments
 (0)