Remove feature flags that are no longer remote capable.

This commit is contained in:
Greyson Parrelli
2020-02-28 17:33:19 -05:00
parent 8e795c4177
commit 6813f47bc1
2 changed files with 92 additions and 25 deletions

View File

@@ -149,7 +149,7 @@ public final class FeatureFlags {
SignalStore.remoteConfigValues().setPendingConfig(mapToJson(result.getDisk()));
REMOTE_VALUES.clear();
REMOTE_VALUES.putAll(result.getMemory());
triggerFlagChangeListeners(result.getChanges());
triggerFlagChangeListeners(result.getMemoryChanges());
SignalStore.remoteConfigValues().setLastFetchTime(System.currentTimeMillis());
@@ -271,6 +271,17 @@ public final class FeatureFlags {
}
});
Stream.of(allKeys)
.filterNot(remoteCapable::contains)
.filterNot(key -> sticky.contains(key) && localDisk.get(key) == Boolean.TRUE)
.forEach(key -> {
newDisk.remove(key);
if (hotSwap.contains(key)) {
newMemory.remove(key);
}
});
return new UpdateResult(newMemory, newDisk, computeChanges(localMemory, newMemory));
}
@@ -367,12 +378,12 @@ public final class FeatureFlags {
static final class UpdateResult {
private final Map<String, Boolean> memory;
private final Map<String, Boolean> disk;
private final Map<String, Change> changes;
private final Map<String, Change> memoryChanges;
UpdateResult(@NonNull Map<String, Boolean> memory, @NonNull Map<String, Boolean> disk, @NonNull Map<String, Change> changes) {
this.memory = memory;
this.disk = disk;
this.changes = changes;
UpdateResult(@NonNull Map<String, Boolean> memory, @NonNull Map<String, Boolean> disk, @NonNull Map<String, Change> memoryChanges) {
this.memory = memory;
this.disk = disk;
this.memoryChanges = memoryChanges;
}
public @NonNull Map<String, Boolean> getMemory() {
@@ -383,8 +394,8 @@ public final class FeatureFlags {
return disk;
}
public @NonNull Map<String, Change> getChanges() {
return changes;
public @NonNull Map<String, Change> getMemoryChanges() {
return memoryChanges;
}
}