diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/AbstractSinglePassCrawlAccountsCommand.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/AbstractSinglePassCrawlAccountsCommand.java index c2015aa90..e7133ed54 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/AbstractSinglePassCrawlAccountsCommand.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/AbstractSinglePassCrawlAccountsCommand.java @@ -15,7 +15,6 @@ import net.sourceforge.argparse4j.inf.Subparser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.whispersystems.textsecuregcm.WhisperServerConfiguration; -import org.whispersystems.textsecuregcm.metrics.MetricsUtil; import org.whispersystems.textsecuregcm.storage.Account; import org.whispersystems.textsecuregcm.util.logging.UncaughtExceptionHandler; import reactor.core.publisher.Flux; @@ -67,9 +66,6 @@ public abstract class AbstractSinglePassCrawlAccountsCommand extends Environment this.namespace = namespace; this.commandDependencies = CommandDependencies.build(getName(), environment, configuration); - MetricsUtil.configureRegistries(configuration, environment, commandDependencies.dynamicConfigurationManager()); - - final int segments = Objects.requireNonNull(namespace.getInt(SEGMENT_COUNT)); logger.info("Crawling accounts with {} segments and {} processors", diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandDependencies.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandDependencies.java index 2a47bcc48..99711e050 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandDependencies.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandDependencies.java @@ -22,6 +22,7 @@ import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfigurati import org.whispersystems.textsecuregcm.controllers.SecureStorageController; import org.whispersystems.textsecuregcm.controllers.SecureValueRecovery2Controller; import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager; +import org.whispersystems.textsecuregcm.metrics.MetricsUtil; import org.whispersystems.textsecuregcm.push.ClientPresenceManager; import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisCluster; import org.whispersystems.textsecuregcm.securestorage.SecureStorageClient; @@ -71,6 +72,13 @@ record CommandDependencies( environment.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + DynamicConfigurationManager dynamicConfigurationManager = new DynamicConfigurationManager<>( + configuration.getAppConfig().getApplication(), configuration.getAppConfig().getEnvironment(), + configuration.getAppConfig().getConfigurationName(), DynamicConfiguration.class); + dynamicConfigurationManager.start(); + + MetricsUtil.configureRegistries(configuration, environment, dynamicConfigurationManager); + ClientResources redisClusterClientResources = ClientResources.builder().build(); FaultTolerantRedisCluster cacheCluster = new FaultTolerantRedisCluster("main_cache_cluster", @@ -103,11 +111,6 @@ record CommandDependencies( ExternalServiceCredentialsGenerator secureValueRecoveryCredentialsGenerator = SecureValueRecovery2Controller.credentialsGenerator( configuration.getSvr2Configuration()); - DynamicConfigurationManager dynamicConfigurationManager = new DynamicConfigurationManager<>( - configuration.getAppConfig().getApplication(), configuration.getAppConfig().getEnvironment(), - configuration.getAppConfig().getConfigurationName(), DynamicConfiguration.class); - dynamicConfigurationManager.start(); - ExperimentEnrollmentManager experimentEnrollmentManager = new ExperimentEnrollmentManager( dynamicConfigurationManager); diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/MessagePersisterServiceCommand.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/MessagePersisterServiceCommand.java index ad8ca787d..dd331af85 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/MessagePersisterServiceCommand.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/MessagePersisterServiceCommand.java @@ -9,14 +9,12 @@ import io.dropwizard.core.Application; import io.dropwizard.core.cli.ServerCommand; import io.dropwizard.core.server.DefaultServerFactory; import io.dropwizard.core.setup.Environment; -import java.time.Duration; import io.dropwizard.jetty.HttpsConnectorFactory; +import java.time.Duration; import net.sourceforge.argparse4j.inf.Namespace; import net.sourceforge.argparse4j.inf.Subparser; import org.whispersystems.textsecuregcm.WhisperServerConfiguration; -import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration; import org.whispersystems.textsecuregcm.metrics.MetricsUtil; -import org.whispersystems.textsecuregcm.storage.DynamicConfigurationManager; import org.whispersystems.textsecuregcm.storage.MessagePersister; import org.whispersystems.textsecuregcm.util.logging.UncaughtExceptionHandler; @@ -52,8 +50,6 @@ public class MessagePersisterServiceCommand extends ServerCommand { @@ -63,20 +59,11 @@ public class MessagePersisterServiceCommand extends ServerCommand dynamicConfigurationManager = new DynamicConfigurationManager<>( - configuration.getAppConfig().getApplication(), - configuration.getAppConfig().getEnvironment(), - configuration.getAppConfig().getConfigurationName(), - DynamicConfiguration.class); - - dynamicConfigurationManager.start(); - final MessagePersister messagePersister = new MessagePersister(deps.messagesCache(), deps.messagesManager(), deps.accountsManager(), deps.clientPresenceManager(), deps.keysManager(), - dynamicConfigurationManager, + deps.dynamicConfigurationManager(), Duration.ofMinutes(configuration.getMessageCacheConfiguration().getPersistDelayMinutes()), namespace.getInt(WORKER_COUNT), environment.lifecycle().executorService("messagePersisterUnlinkDeviceExecutor-%d") diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/ScheduledApnPushNotificationSenderServiceCommand.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/ScheduledApnPushNotificationSenderServiceCommand.java index 6579f633b..8c063635f 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/ScheduledApnPushNotificationSenderServiceCommand.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/ScheduledApnPushNotificationSenderServiceCommand.java @@ -54,8 +54,6 @@ public class ScheduledApnPushNotificationSenderServiceCommand extends ServerComm final CommandDependencies deps = CommandDependencies.build("scheduled-apn-sender", environment, configuration); - MetricsUtil.configureRegistries(configuration, environment, deps.dynamicConfigurationManager()); - if (configuration.getServerFactory() instanceof DefaultServerFactory defaultServerFactory) { defaultServerFactory.getApplicationConnectors() .forEach(connectorFactory -> { @@ -65,7 +63,6 @@ public class ScheduledApnPushNotificationSenderServiceCommand extends ServerComm }); } - final FaultTolerantRedisCluster pushSchedulerCluster = new FaultTolerantRedisCluster("push_scheduler", configuration.getPushSchedulerCluster(), deps.redisClusterClientResources());