diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/experiment/NotifyIdleDevicesWithoutMessagesPushNotificationExperiment.java b/service/src/main/java/org/whispersystems/textsecuregcm/experiment/NotifyIdleDevicesWithoutMessagesPushNotificationExperiment.java index aeb129dd4..500509e5b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/experiment/NotifyIdleDevicesWithoutMessagesPushNotificationExperiment.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/experiment/NotifyIdleDevicesWithoutMessagesPushNotificationExperiment.java @@ -64,8 +64,8 @@ public class NotifyIdleDevicesWithoutMessagesPushNotificationExperiment implemen return CompletableFuture.completedFuture(false); } - return messagesManager.mayHaveMessages(account.getIdentifier(IdentityType.ACI), device) - .thenApply(mayHaveMessages -> !mayHaveMessages); + return messagesManager.mayHavePersistedMessages(account.getIdentifier(IdentityType.ACI), device) + .thenApply(mayHavePersistedMessages -> !mayHavePersistedMessages); } @VisibleForTesting diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/MessagesManager.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/MessagesManager.java index 414512290..2c7cc4011 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/MessagesManager.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/MessagesManager.java @@ -67,6 +67,10 @@ public class MessagesManager { } } + public CompletableFuture mayHavePersistedMessages(final UUID destinationUuid, final Device destinationDevice) { + return messagesDynamoDb.mayHaveMessages(destinationUuid, destinationDevice); + } + public CompletableFuture mayHaveMessages(final UUID destinationUuid, final Device destinationDevice) { return messagesCache.hasMessagesAsync(destinationUuid, destinationDevice.getId()) .thenCombine(messagesDynamoDb.mayHaveMessages(destinationUuid, destinationDevice), diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/experiment/NotifyIdleDevicesWithoutMessagesPushNotificationExperimentTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/experiment/NotifyIdleDevicesWithoutMessagesPushNotificationExperimentTest.java index 9b37bf154..9bb1a6531 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/experiment/NotifyIdleDevicesWithoutMessagesPushNotificationExperimentTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/experiment/NotifyIdleDevicesWithoutMessagesPushNotificationExperimentTest.java @@ -53,7 +53,7 @@ class NotifyIdleDevicesWithoutMessagesPushNotificationExperimentTest { final boolean mayHaveMessages, final boolean expectEligible) { - when(messagesManager.mayHaveMessages(account.getIdentifier(IdentityType.ACI), device)) + when(messagesManager.mayHavePersistedMessages(account.getIdentifier(IdentityType.ACI), device)) .thenReturn(CompletableFuture.completedFuture(mayHaveMessages)); when(idleDeviceNotificationScheduler.isIdle(device)).thenReturn(isDeviceIdle);