Fix deadlock when retrieve avatars.
This commit is contained in:
parent
84296a3860
commit
0b47c2ae93
1 changed files with 5 additions and 3 deletions
|
@ -73,7 +73,8 @@ public class RetrieveProfileJob extends BaseJob {
|
||||||
|
|
||||||
private static final String TAG = Log.tag(RetrieveProfileJob.class);
|
private static final String TAG = Log.tag(RetrieveProfileJob.class);
|
||||||
|
|
||||||
private static final String KEY_RECIPIENTS = "recipients";
|
private static final String KEY_RECIPIENTS = "recipients";
|
||||||
|
private static final String DEDUPE_KEY_RETRIEVE_AVATAR = KEY + "_RETRIEVE_PROFILE_AVATAR";
|
||||||
|
|
||||||
private final Set<RecipientId> recipientIds;
|
private final Set<RecipientId> recipientIds;
|
||||||
|
|
||||||
|
@ -497,9 +498,10 @@ public class RetrieveProfileJob extends BaseJob {
|
||||||
|
|
||||||
private static void setProfileAvatar(Recipient recipient, String profileAvatar) {
|
private static void setProfileAvatar(Recipient recipient, String profileAvatar) {
|
||||||
if (recipient.getProfileKey() == null) return;
|
if (recipient.getProfileKey() == null) return;
|
||||||
|
|
||||||
if (!Util.equals(profileAvatar, recipient.getProfileAvatar())) {
|
if (!Util.equals(profileAvatar, recipient.getProfileAvatar())) {
|
||||||
ApplicationDependencies.getJobManager().add(new RetrieveProfileAvatarJob(recipient, profileAvatar));
|
SignalDatabase.runPostSuccessfulTransaction(DEDUPE_KEY_RETRIEVE_AVATAR + recipient.getId(), () -> {
|
||||||
|
ApplicationDependencies.getJobManager().add(new RetrieveProfileAvatarJob(recipient, profileAvatar));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue