mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-22 08:08:01 +01:00
Publish "messages persisted" events when unlocking queues after a persistence run
This commit is contained in:
committed by
Jon Chambers
parent
084607f359
commit
562b495a18
@@ -20,10 +20,8 @@ import io.lettuce.core.cluster.pubsub.api.async.RedisClusterPubSubAsyncCommands;
|
||||
import io.lettuce.core.cluster.pubsub.api.sync.RedisClusterPubSubCommands;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.IntStream;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
@@ -140,30 +138,6 @@ class PubSubClientEventManagerTest {
|
||||
assertTrue(firstListenerConnectedElsewhere.get());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(booleans = {true, false})
|
||||
void handleMessagesPersisted(final boolean messagesPersistedRemotely) throws InterruptedException {
|
||||
final UUID accountIdentifier = UUID.randomUUID();
|
||||
final byte deviceId = Device.PRIMARY_ID;
|
||||
|
||||
final CountDownLatch messagesPersistedLatch = new CountDownLatch(1);
|
||||
|
||||
localPresenceManager.handleClientConnected(accountIdentifier, deviceId, new ClientEventAdapter() {
|
||||
@Override
|
||||
public void handleMessagesPersisted() {
|
||||
messagesPersistedLatch.countDown();
|
||||
}
|
||||
}).toCompletableFuture().join();
|
||||
|
||||
final PubSubClientEventManager persistingPresenceManager =
|
||||
messagesPersistedRemotely ? remotePresenceManager : localPresenceManager;
|
||||
|
||||
persistingPresenceManager.handleMessagesPersisted(accountIdentifier, deviceId).toCompletableFuture().join();
|
||||
|
||||
assertTrue(messagesPersistedLatch.await(2, TimeUnit.SECONDS),
|
||||
"Message persistence event not received within time limit");
|
||||
}
|
||||
|
||||
@Test
|
||||
void isLocallyPresent() {
|
||||
final UUID accountIdentifier = UUID.randomUUID();
|
||||
|
||||
Reference in New Issue
Block a user