mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 08:38:03 +01:00
Use a memoizing supplier instead of a looping thread to cache remote config entries
This commit is contained in:
committed by
Chris Eager
parent
d89b4f7e95
commit
048e17c62b
@@ -29,21 +29,18 @@ public class RemoteConfigsManagerTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
RemoteConfigs remoteConfigs = new RemoteConfigs(new FaultTolerantDatabase("remote_configs-test", Jdbi.create(db.getTestDatabase()), new CircuitBreakerConfiguration()));
|
||||
this.remoteConfigs = new RemoteConfigsManager(remoteConfigs, 500);
|
||||
this.remoteConfigs.start();
|
||||
this.remoteConfigs = new RemoteConfigsManager(new RemoteConfigs(
|
||||
new FaultTolerantDatabase("remote_configs-test", Jdbi.create(db.getTestDatabase()), new CircuitBreakerConfiguration())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate() throws InterruptedException {
|
||||
public void testUpdate() {
|
||||
remoteConfigs.set(new RemoteConfig("android.stickers", 50, Set.of(AuthHelper.VALID_UUID), "FALSE", "TRUE", null));
|
||||
remoteConfigs.set(new RemoteConfig("value.sometimes", 50, Set.of(), "bar", "baz", null));
|
||||
remoteConfigs.set(new RemoteConfig("ios.stickers", 50, Set.of(), "FALSE", "TRUE", null));
|
||||
remoteConfigs.set(new RemoteConfig("ios.stickers", 75, Set.of(), "FALSE", "TRUE", null));
|
||||
remoteConfigs.set(new RemoteConfig("value.sometimes", 25, Set.of(AuthHelper.VALID_UUID), "abc", "def", null));
|
||||
|
||||
remoteConfigs.waitForCacheRefresh();
|
||||
|
||||
List<RemoteConfig> results = remoteConfigs.getAll();
|
||||
|
||||
assertThat(results.size()).isEqualTo(3);
|
||||
|
||||
Reference in New Issue
Block a user