mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 01:28:03 +01:00
Don't retry pub/sub commands
This commit is contained in:
committed by
Jon Chambers
parent
c9a396b9e3
commit
00d0dba62c
@@ -7,7 +7,6 @@ package org.whispersystems.textsecuregcm.redis;
|
||||
|
||||
import static org.whispersystems.textsecuregcm.metrics.MetricsUtil.name;
|
||||
|
||||
import io.github.resilience4j.retry.Retry;
|
||||
import io.lettuce.core.RedisException;
|
||||
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
|
||||
import io.micrometer.core.instrument.Metrics;
|
||||
@@ -20,17 +19,11 @@ abstract class AbstractFaultTolerantPubSubConnection<K, V, C extends StatefulRed
|
||||
private final String name;
|
||||
private final C pubSubConnection;
|
||||
|
||||
private final Retry retry;
|
||||
|
||||
private final Timer executeTimer;
|
||||
|
||||
protected AbstractFaultTolerantPubSubConnection(final String name,
|
||||
final C pubSubConnection,
|
||||
final Retry retry) {
|
||||
|
||||
protected AbstractFaultTolerantPubSubConnection(final String name, final C pubSubConnection) {
|
||||
this.name = name;
|
||||
this.pubSubConnection = pubSubConnection;
|
||||
this.retry = retry;
|
||||
|
||||
this.executeTimer = Metrics.timer(name(getClass(), "execute"), "clusterName", name + "-pubsub");
|
||||
}
|
||||
@@ -41,7 +34,7 @@ abstract class AbstractFaultTolerantPubSubConnection<K, V, C extends StatefulRed
|
||||
|
||||
public void usePubSubConnection(final Consumer<C> consumer) {
|
||||
try {
|
||||
retry.executeRunnable(() -> executeTimer.record(() -> consumer.accept(pubSubConnection)));
|
||||
executeTimer.record(() -> consumer.accept(pubSubConnection));
|
||||
} catch (final Throwable t) {
|
||||
if (t instanceof RedisException) {
|
||||
throw (RedisException) t;
|
||||
@@ -53,7 +46,7 @@ abstract class AbstractFaultTolerantPubSubConnection<K, V, C extends StatefulRed
|
||||
|
||||
public <T> T withPubSubConnection(final Function<C, T> function) {
|
||||
try {
|
||||
return retry.executeCallable(() -> executeTimer.record(() -> function.apply(pubSubConnection)));
|
||||
return executeTimer.record(() -> function.apply(pubSubConnection));
|
||||
} catch (final Throwable t) {
|
||||
if (t instanceof RedisException) {
|
||||
throw (RedisException) t;
|
||||
|
||||
@@ -21,11 +21,10 @@ public class FaultTolerantPubSubClusterConnection<K, V> extends AbstractFaultTol
|
||||
|
||||
protected FaultTolerantPubSubClusterConnection(final String name,
|
||||
final StatefulRedisClusterPubSubConnection<K, V> pubSubConnection,
|
||||
final Retry retry,
|
||||
final Retry resubscribeRetry,
|
||||
final Scheduler topologyChangedEventScheduler) {
|
||||
|
||||
super(name, pubSubConnection, retry);
|
||||
super(name, pubSubConnection);
|
||||
|
||||
pubSubConnection.setNodeMessagePropagation(true);
|
||||
|
||||
|
||||
@@ -5,15 +5,13 @@
|
||||
|
||||
package org.whispersystems.textsecuregcm.redis;
|
||||
|
||||
import io.github.resilience4j.retry.Retry;
|
||||
import io.lettuce.core.pubsub.StatefulRedisPubSubConnection;
|
||||
|
||||
public class FaultTolerantPubSubConnection<K, V> extends AbstractFaultTolerantPubSubConnection<K, V, StatefulRedisPubSubConnection<K, V>> {
|
||||
|
||||
protected FaultTolerantPubSubConnection(final String name,
|
||||
final StatefulRedisPubSubConnection<K, V> pubSubConnection,
|
||||
final Retry retry) {
|
||||
final StatefulRedisPubSubConnection<K, V> pubSubConnection) {
|
||||
|
||||
super(name, pubSubConnection, retry);
|
||||
super(name, pubSubConnection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,13 +147,13 @@ public class FaultTolerantRedisClient {
|
||||
final StatefulRedisPubSubConnection<String, String> pubSubConnection = redisClient.connectPubSub();
|
||||
pubSubConnections.add(pubSubConnection);
|
||||
|
||||
return new FaultTolerantPubSubConnection<>(name, pubSubConnection, retry);
|
||||
return new FaultTolerantPubSubConnection<>(name, pubSubConnection);
|
||||
}
|
||||
|
||||
public FaultTolerantPubSubConnection<byte[], byte[]> createBinaryPubSubConnection() {
|
||||
final StatefulRedisPubSubConnection<byte[], byte[]> pubSubConnection = redisClient.connectPubSub(ByteArrayCodec.INSTANCE);
|
||||
pubSubConnections.add(pubSubConnection);
|
||||
|
||||
return new FaultTolerantPubSubConnection<>(name, pubSubConnection, retry);
|
||||
return new FaultTolerantPubSubConnection<>(name, pubSubConnection);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ public class FaultTolerantRedisClusterClient {
|
||||
final StatefulRedisClusterPubSubConnection<String, String> pubSubConnection = clusterClient.connectPubSub();
|
||||
pubSubConnections.add(pubSubConnection);
|
||||
|
||||
return new FaultTolerantPubSubClusterConnection<>(name, pubSubConnection, retry, topologyChangedEventRetry,
|
||||
return new FaultTolerantPubSubClusterConnection<>(name, pubSubConnection, topologyChangedEventRetry,
|
||||
Schedulers.newSingle(name + "-redisPubSubEvents", true));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user