mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-11-30 01:16:50 +00:00
Don't fall back to v4 UUIDs if FoundationDB insert fails
This commit is contained in:
1 parent
7489c62fb7
commit
f92681dbae
2 files changed
+10
-5
No files matched your search
@@ -34,7 +34,6 @@ import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
|
||||
import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager;
|
||||
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
|
||||
import org.whispersystems.textsecuregcm.identity.IdentityType;
|
||||
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
|
||||
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
|
||||
import org.whispersystems.textsecuregcm.push.RedisMessageAvailabilityManager;
|
||||
@@ -143,7 +142,7 @@ public class MessagesManager {
|
||||
e);
|
||||
}
|
||||
|
||||
return Collections.emptyMap();
|
||||
throw ExceptionUtils.wrap(e);
|
||||
});
|
||||
} else {
|
||||
foundationDbInsertFuture = CompletableFuture.completedFuture(Collections.emptyMap());
|
||||
|
||||
+9
-3
@@ -6,6 +6,8 @@
|
||||
package org.whispersystems.textsecuregcm.storage;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyByte;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
@@ -29,6 +31,7 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -44,7 +47,6 @@ import org.signal.libsignal.protocol.ServiceId;
|
||||
import org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
|
||||
import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager;
|
||||
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
|
||||
import org.whispersystems.textsecuregcm.identity.IdentityType;
|
||||
import org.whispersystems.textsecuregcm.identity.PniServiceIdentifier;
|
||||
import org.whispersystems.textsecuregcm.push.RedisMessageAvailabilityManager;
|
||||
import org.whispersystems.textsecuregcm.storage.foundationdb.FoundationDbMessageStore;
|
||||
@@ -141,10 +143,14 @@ class MessagesManagerTest {
|
||||
|
||||
final UUID destinationUuid = UUID.randomUUID();
|
||||
|
||||
messagesManager.insert(destinationUuid, Map.of(Device.PRIMARY_ID, message));
|
||||
final CompletionException completionException =
|
||||
assertThrows(CompletionException.class,
|
||||
() -> messagesManager.insert(destinationUuid, Map.of(Device.PRIMARY_ID, message)));
|
||||
|
||||
assertInstanceOf(RuntimeException.class, completionException.getCause());
|
||||
|
||||
verify(foundationDbMessageStore).insert(any(), any());
|
||||
verify(messagesCache)
|
||||
verify(messagesCache, never())
|
||||
.insert(argThat(messageGuid -> messageGuid.version() == 4),
|
||||
eq(destinationUuid),
|
||||
eq(Device.PRIMARY_ID),
|
||||
|
||||
Reference in new issue
Block a user