mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 09:47:58 +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
@@ -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