Separate network and processing of profile fetches.

This commit is contained in:
Cody Henthorne
2021-12-21 15:57:35 -05:00
committed by Alex Hart
parent bbadda5656
commit 3eb8db00aa

View File

@@ -268,7 +268,6 @@ public class RetrieveProfileJob extends BaseJob {
ProfileService.ProfileResponseProcessor processor = new ProfileService.ProfileResponseProcessor(pair.second());
if (processor.hasResult()) {
state.profiles.add(processor.getResult(recipient));
process(recipient, processor.getResult());
} else if (processor.notFound()) {
Log.w(TAG, "Failed to find a profile for " + recipient.getId());
if (recipient.isRegistered()) {
@@ -284,7 +283,13 @@ public class RetrieveProfileJob extends BaseJob {
.lastOrError()
.blockingGet();
stopwatch.split("network-process");
stopwatch.split("responses");
for (Pair<Recipient, ProfileAndCredential> profile : operationState.profiles) {
process(profile.first(), profile.second());
}
stopwatch.split("process");
Set<RecipientId> success = SetUtil.difference(recipientIds, operationState.retries);
recipientDatabase.markProfilesFetched(success, System.currentTimeMillis());