mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 17:58:03 +01:00
Remove keyspace notification configuration checks because AWS doesn't support CONFIG GET.
This commit is contained in:
committed by
Jon Chambers
parent
72c6a4289e
commit
77460ba502
@@ -17,7 +17,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.textsecuregcm.redis.ClusterLuaScript;
|
||||
import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisCluster;
|
||||
import org.whispersystems.textsecuregcm.util.Constants;
|
||||
import org.whispersystems.textsecuregcm.util.RedisClusterUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
@@ -82,8 +81,6 @@ public class ClientPresenceManager extends RedisClusterPubSubAdapter<String, Str
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
RedisClusterUtil.assertKeyspaceNotificationsConfigured(presenceCluster, "K$");
|
||||
|
||||
presenceCluster.usePubSubConnection(connection -> {
|
||||
connection.addListener(this);
|
||||
connection.getResources().eventBus().get()
|
||||
|
||||
@@ -78,8 +78,6 @@ public class RedisClusterMessagesCache extends RedisClusterPubSubAdapter<String,
|
||||
this.removeQueueScript = ClusterLuaScript.fromResource(redisCluster, "lua/remove_queue.lua", ScriptOutputType.STATUS);
|
||||
this.getQueuesToPersistScript = ClusterLuaScript.fromResource(redisCluster, "lua/get_queues_to_persist.lua", ScriptOutputType.MULTI);
|
||||
|
||||
RedisClusterUtil.assertKeyspaceNotificationsConfigured(redisCluster, "K$gz");
|
||||
|
||||
redisCluster.usePubSubConnection(connection -> {
|
||||
connection.addListener(this);
|
||||
connection.getResources().eventBus().get()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.whispersystems.textsecuregcm.util;
|
||||
|
||||
import io.lettuce.core.cluster.SlotHash;
|
||||
import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisCluster;
|
||||
|
||||
public class RedisClusterUtil {
|
||||
|
||||
@@ -34,27 +33,4 @@ public class RedisClusterUtil {
|
||||
public static String getMinimalHashTag(final int slot) {
|
||||
return HASHES_BY_SLOT[slot];
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a Redis cluster is configured to generate (at least) a specific set of keyspace notification events.
|
||||
*
|
||||
* @param redisCluster the Redis cluster to check for the required keyspace notification configuration
|
||||
* @param requiredKeyspaceNotifications a string representing the required keyspace notification events (e.g. "Kg$lz")
|
||||
*
|
||||
* @throws IllegalStateException if the given Redis cluster is not configured to generate the required keyspace
|
||||
* notification events
|
||||
*
|
||||
* @see <a href="https://redis.io/topics/notifications#configuration">Redis Keyspace Notifications - Configuration</a>
|
||||
*/
|
||||
public static void assertKeyspaceNotificationsConfigured(final FaultTolerantRedisCluster redisCluster, final String requiredKeyspaceNotifications) {
|
||||
final String configuredKeyspaceNotifications = redisCluster.withReadCluster(connection -> connection.sync().configGet("notify-keyspace-events"))
|
||||
.getOrDefault("notify-keyspace-events", "")
|
||||
.replace("A", "g$lshztxe");
|
||||
|
||||
for (final char requiredNotificationType : requiredKeyspaceNotifications.toCharArray()) {
|
||||
if (configuredKeyspaceNotifications.indexOf(requiredNotificationType) == -1) {
|
||||
throw new IllegalStateException(String.format("Required at least \"%s\" for keyspace notifications, but only had \"%s\".", requiredKeyspaceNotifications, configuredKeyspaceNotifications));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user