mirror of
https://github.com/signalapp/Signal-Server
synced 2026-08-17 05:52:17 +01:00
Log dropped persistence errors via a hook
This commit is contained in:
committed by
Jon Chambers
parent
8154bb1047
commit
af2d276f37
+8
@@ -16,10 +16,13 @@ import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import net.sourceforge.argparse4j.inf.Namespace;
|
||||
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.MessagePersister;
|
||||
import org.whispersystems.textsecuregcm.util.logging.UncaughtExceptionHandler;
|
||||
import reactor.core.publisher.Hooks;
|
||||
import reactor.core.scheduler.Scheduler;
|
||||
import reactor.core.scheduler.Schedulers;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -34,6 +37,8 @@ public class MessagePersisterServiceCommand extends ServerCommand<WhisperServerC
|
||||
|
||||
private static final String MAX_CONCURRENCY = "maxConcurrency";
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MessagePersisterServiceCommand.class);
|
||||
|
||||
public MessagePersisterServiceCommand() {
|
||||
super(new Application<>() {
|
||||
@Override
|
||||
@@ -61,6 +66,7 @@ public class MessagePersisterServiceCommand extends ServerCommand<WhisperServerC
|
||||
throws Exception {
|
||||
|
||||
UncaughtExceptionHandler.register();
|
||||
Hooks.onErrorDropped(e -> logger.warn("Dropped message persistence error", e));
|
||||
|
||||
final CommandDependencies deps = CommandDependencies.build("message-persister-service", environment, configuration);
|
||||
MetricsUtil.configureRegistries(configuration, environment, deps.dynamicConfigurationManager());
|
||||
@@ -95,6 +101,8 @@ public class MessagePersisterServiceCommand extends ServerCommand<WhisperServerC
|
||||
protected void cleanup() {
|
||||
super.cleanup();
|
||||
|
||||
Hooks.resetOnErrorDropped();
|
||||
|
||||
if (persistQueueScheduler != null) {
|
||||
persistQueueScheduler.dispose();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user