diff --git a/service/config/sample.yml b/service/config/sample.yml index e9cd12eea..ec0b1fcc5 100644 --- a/service/config/sample.yml +++ b/service/config/sample.yml @@ -452,8 +452,5 @@ registrationService: turn: secret: secret://turn.secret -commandStopListener: - path: /example/path - linkDevice: secret: secret://linkDevice.secret diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java index 6c7bca05d..7b32ce23b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/WhisperServerConfiguration.java @@ -26,7 +26,6 @@ import org.whispersystems.textsecuregcm.configuration.Cdn3StorageManagerConfigur import org.whispersystems.textsecuregcm.configuration.CdnConfiguration; import org.whispersystems.textsecuregcm.configuration.ClientCdnConfiguration; import org.whispersystems.textsecuregcm.configuration.ClientReleaseConfiguration; -import org.whispersystems.textsecuregcm.configuration.CommandStopListenerConfiguration; import org.whispersystems.textsecuregcm.configuration.DirectoryV2Configuration; import org.whispersystems.textsecuregcm.configuration.DogstatsdConfiguration; import org.whispersystems.textsecuregcm.configuration.DynamoDbClientConfiguration; @@ -312,11 +311,6 @@ public class WhisperServerConfiguration extends Configuration { @JsonProperty private MessageByteLimitCardinalityEstimatorConfiguration messageByteLimitCardinalityEstimator = new MessageByteLimitCardinalityEstimatorConfiguration(Duration.ofDays(1)); - @Valid - @NotNull - @JsonProperty - private CommandStopListenerConfiguration commandStopListener; - @Valid @NotNull @JsonProperty @@ -530,10 +524,6 @@ public class WhisperServerConfiguration extends Configuration { return messageByteLimitCardinalityEstimator; } - public CommandStopListenerConfiguration getCommandStopListener() { - return commandStopListener; - } - public LinkDeviceSecretConfiguration getLinkDeviceSecretConfiguration() { return linkDevice; } diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/CommandStopListenerConfiguration.java b/service/src/main/java/org/whispersystems/textsecuregcm/configuration/CommandStopListenerConfiguration.java deleted file mode 100644 index 0b43720aa..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/configuration/CommandStopListenerConfiguration.java +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2023 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ - -package org.whispersystems.textsecuregcm.configuration; - -import javax.validation.constraints.NotNull; - -public record CommandStopListenerConfiguration(@NotNull String path) { - -} 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 cf175fce5..7e8549514 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/AbstractSinglePassCrawlAccountsCommand.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/AbstractSinglePassCrawlAccountsCommand.java @@ -70,8 +70,6 @@ public abstract class AbstractSinglePassCrawlAccountsCommand extends Environment final int segments = Objects.requireNonNull(namespace.getInt(SEGMENT_COUNT)); - environment.lifecycle().manage(new CommandStopListener(configuration.getCommandStopListener())); - logger.info("Crawling accounts with {} segments and {} processors", segments, Runtime.getRuntime().availableProcessors()); diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandStopListener.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandStopListener.java deleted file mode 100644 index 2c43b6e1a..000000000 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/CommandStopListener.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2023 Signal Messenger, LLC - * SPDX-License-Identifier: AGPL-3.0-only - */ - -package org.whispersystems.textsecuregcm.workers; - -import io.dropwizard.lifecycle.Managed; -import java.io.FileWriter; -import java.io.IOException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.whispersystems.textsecuregcm.configuration.CommandStopListenerConfiguration; - -/** - * When {@link Managed#stop()} is called, writes to a configured file path - *

- * Useful for coordinating process termination via a shared file-system, such as a Kubernetes volume mount. - */ -public class CommandStopListener implements Managed { - - private static final Logger logger = LoggerFactory.getLogger(CommandStopListener.class); - - private final String path; - - CommandStopListener(CommandStopListenerConfiguration config) { - this.path = config.path(); - } - - @Override - public void start() { - - } - - @Override - public void stop() { - try { - try (FileWriter writer = new FileWriter(path)) { - writer.write("stopped"); - } - } catch (final IOException e) { - logger.error("Failed to open file {}", path, e); - } - } -} diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/UnlinkDeviceCommand.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/UnlinkDeviceCommand.java index 490809d6c..c6b9b5669 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/UnlinkDeviceCommand.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/UnlinkDeviceCommand.java @@ -52,10 +52,6 @@ public class UnlinkDeviceCommand extends EnvironmentCommand deviceIds = namespace.getList("deviceIds"); @@ -73,8 +69,5 @@ public class UnlinkDeviceCommand extends EnvironmentCommand