From 42ed6c3ded900b0b79a1ca920dd0eb29e2ff8d5d Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Mon, 19 Oct 2020 11:00:15 -0400 Subject: [PATCH] Add clients to the "cleanup" list before actually setting their presence keys. --- .../textsecuregcm/push/ClientPresenceManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/push/ClientPresenceManager.java b/service/src/main/java/org/whispersystems/textsecuregcm/push/ClientPresenceManager.java index e8908454c..a165725cf 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/push/ClientPresenceManager.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/push/ClientPresenceManager.java @@ -38,6 +38,9 @@ import static com.codahale.metrics.MetricRegistry.name; * The client presence manager keeps track of which clients are actively connected and "present" to receive messages. * Only one client per account/device may be present at a time; if a second client for the same account/device declares * its presence, the previous client is displaced. + *

+ * The client presence manager depends on Redis keyspace notifications and requires that the Redis instance support at + * least the following notification types: {@code K$z}. */ public class ClientPresenceManager extends RedisClusterPubSubAdapter implements Managed { @@ -146,8 +149,8 @@ public class ClientPresenceManager extends RedisClusterPubSubAdapter { final RedisAdvancedClusterCommands commands = connection.sync(); - commands.set(presenceKey, managerId); commands.sadd(connectedClientSetKey, presenceKey); + commands.set(presenceKey, managerId); }); subscribeForRemotePresenceChanges(presenceKey);