mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 09:47:58 +01:00
De-dupe connection event logging messages.
This commit is contained in:
committed by
Jon Chambers
parent
4bae8d4cfb
commit
0431a2abb1
@@ -0,0 +1,22 @@
|
||||
package org.whispersystems.textsecuregcm.redis;
|
||||
|
||||
import io.lettuce.core.cluster.event.ClusterTopologyChangedEvent;
|
||||
import io.lettuce.core.event.connection.ConnectionEvent;
|
||||
import io.lettuce.core.resource.ClientResources;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ConnectionEventLogger {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ConnectionEventLogger.class);
|
||||
|
||||
public static void logConnectionEvents(final ClientResources clientResources) {
|
||||
clientResources.eventBus().get().subscribe(event -> {
|
||||
if (event instanceof ConnectionEvent) {
|
||||
logger.info("Connection event: {}", event);
|
||||
} else if (event instanceof ClusterTopologyChangedEvent) {
|
||||
logger.info("Cluster topology changed: {}", event);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -63,14 +63,6 @@ public class FaultTolerantRedisCluster {
|
||||
this.clusterClient = clusterClient;
|
||||
this.clusterClient.setDefaultTimeout(commandTimeout);
|
||||
|
||||
this.clusterClient.getResources().eventBus().get().subscribe(event -> {
|
||||
if (event instanceof ConnectionEvent) {
|
||||
log.info("Connection event for {}: {}", this.name, event);
|
||||
} else if (event instanceof ClusterTopologyChangedEvent) {
|
||||
log.info("Cluster topology for {} changed: {}", this.name, event);
|
||||
}
|
||||
});
|
||||
|
||||
this.stringConnection = clusterClient.connect();
|
||||
this.binaryConnection = clusterClient.connect(ByteArrayCodec.INSTANCE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user