mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
Retrieve profiles in parallel.
This commit is contained in:
@@ -43,7 +43,7 @@ final class GroupsV2CapabilityChecker {
|
||||
Recipient.Capability gv2Capability = member.getGroupsV2Capability();
|
||||
|
||||
if (gv2Capability != Recipient.Capability.SUPPORTED) {
|
||||
if (!ApplicationDependencies.getJobManager().runSynchronously(RetrieveProfileJob.forRecipient(member), TimeUnit.SECONDS.toMillis(1000)).isPresent()) {
|
||||
if (!ApplicationDependencies.getJobManager().runSynchronously(RetrieveProfileJob.forRecipient(member.getId()), TimeUnit.SECONDS.toMillis(1000)).isPresent()) {
|
||||
throw new IOException("Recipient capability was not retrieved in time");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,17 +59,12 @@ public final class GroupCandidateHelper {
|
||||
ProfileKey profileKey = ProfileKeyUtil.profileKeyOrNull(recipient.getProfileKey());
|
||||
|
||||
if (profileKey != null) {
|
||||
try {
|
||||
Optional<ProfileKeyCredential> profileKeyCredentialOptional = signalServiceAccountManager.resolveProfileKeyCredential(uuid, profileKey);
|
||||
Optional<ProfileKeyCredential> profileKeyCredentialOptional = signalServiceAccountManager.resolveProfileKeyCredential(uuid, profileKey);
|
||||
|
||||
if (profileKeyCredentialOptional.isPresent()) {
|
||||
candidate = candidate.withProfileKeyCredential(profileKeyCredentialOptional.get());
|
||||
if (profileKeyCredentialOptional.isPresent()) {
|
||||
candidate = candidate.withProfileKeyCredential(profileKeyCredentialOptional.get());
|
||||
|
||||
recipientDatabase.setProfileKeyCredential(recipient.getId(), profileKey, profileKeyCredentialOptional.get());
|
||||
}
|
||||
} catch (VerificationFailedException e) {
|
||||
Log.w(TAG, e);
|
||||
throw new IOException(e);
|
||||
recipientDatabase.setProfileKeyCredential(recipient.getId(), profileKey, profileKeyCredentialOptional.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,9 +290,7 @@ public final class GroupsV2StateProcessor {
|
||||
|
||||
if (!updated.isEmpty()) {
|
||||
Log.i(TAG, String.format(Locale.US, "Learned %d new profile keys, scheduling profile retrievals", updated.size()));
|
||||
for (RecipientId recipient : updated) {
|
||||
ApplicationDependencies.getJobManager().add(RetrieveProfileJob.forRecipient(recipient));
|
||||
}
|
||||
RetrieveProfileJob.enqueue(updated);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user