Clear presence only if the connection’s displacement listener is still present

This commit is contained in:
Chris Eager authored and Chris Eager committed 2023-10-03 11:42:25 -05:00
1 parent 407070c9fc
commit 8c7975d89a
2 files changed
+7 -3

No files matched your search

@@ -235,11 +235,12 @@ public class ClientPresenceManager extends RedisClusterPubSubAdapter<String, Str
public boolean clearPresence(final UUID accountUuid, final long deviceId, final DisplacedPresenceListener listener) {
final String presenceKey = getPresenceKey(accountUuid, deviceId);
if (!displacementListenersByPresenceKey.remove(presenceKey, listener)) {
if (displacementListenersByPresenceKey.remove(presenceKey, listener)) {
return clearPresence(presenceKey);
} else {
displacementListenerAlreadyRemovedCounter.increment();
return false;
}
return clearPresence(presenceKey);
}
private boolean clearPresence(final String presenceKey) {