Improve cold start performance.

This commit is contained in:
Cody Henthorne
2022-07-21 12:29:58 -04:00
parent d159a0482a
commit fe6058e0df
28 changed files with 82 additions and 97 deletions

View File

@@ -52,8 +52,8 @@ public final class GroupsV1MigrationUtil {
throw new InvalidMigrationStateException();
}
if (groupRecipient.getParticipants().size() > FeatureFlags.groupLimits().getHardLimit()) {
Log.w(TAG, "Too many members! Size: " + groupRecipient.getParticipants().size());
if (groupRecipient.getParticipantIds().size() > FeatureFlags.groupLimits().getHardLimit()) {
Log.w(TAG, "Too many members! Size: " + groupRecipient.getParticipantIds().size());
throw new InvalidMigrationStateException();
}
@@ -86,7 +86,7 @@ public final class GroupsV1MigrationUtil {
throw new InvalidMigrationStateException();
}
List<Recipient> registeredMembers = RecipientUtil.getEligibleForSending(groupRecipient.getParticipants());
List<Recipient> registeredMembers = RecipientUtil.getEligibleForSending(Recipient.resolvedList(groupRecipient.getParticipantIds()));
if (RecipientUtil.ensureUuidsAreAvailable(context, registeredMembers)) {
Log.i(TAG, "Newly-discovered UUIDs. Getting fresh recipients.");

View File

@@ -68,7 +68,8 @@ final class GroupsV1MigrationRepository {
return new MigrationState(Collections.emptyList(), Collections.emptyList());
}
Set<RecipientId> needsRefresh = Stream.of(group.getParticipants())
List<Recipient> members = Recipient.resolvedList(group.getParticipantIds());
Set<RecipientId> needsRefresh = Stream.of(members)
.filter(r -> r.getGroupsV1MigrationCapability() != Recipient.Capability.SUPPORTED)
.map(Recipient::getId)
.collect(Collectors.toSet());
@@ -82,7 +83,7 @@ final class GroupsV1MigrationRepository {
}
try {
List<Recipient> registered = Stream.of(group.getParticipants())
List<Recipient> registered = Stream.of(members)
.filter(Recipient::isRegistered)
.toList();
@@ -93,13 +94,13 @@ final class GroupsV1MigrationRepository {
group = group.fresh();
List<Recipient> ineligible = Stream.of(group.getParticipants())
List<Recipient> ineligible = Stream.of(members)
.filter(r -> !r.hasServiceId() ||
r.getGroupsV1MigrationCapability() != Recipient.Capability.SUPPORTED ||
r.getRegistered() != RecipientDatabase.RegisteredState.REGISTERED)
.toList();
List<Recipient> invites = Stream.of(group.getParticipants())
List<Recipient> invites = Stream.of(members)
.filterNot(ineligible::contains)
.filterNot(Recipient::isSelf)
.filter(r -> r.getProfileKey() == null)