Fix deadlock when sending media to story and group chat simultaneously.

This commit is contained in:
Cody Henthorne
2026-03-27 12:22:22 -04:00
committed by Alex Hart
parent 57574126bb
commit e125fa6bfb

View File

@@ -425,14 +425,6 @@ public class MessageSender {
} }
} }
for (AttachmentId attachmentId : attachmentsWithPreuploadId) {
long messageId = SignalDatabase.attachments().getMessageId(attachmentId);
if (BackupRepository.shouldCopyAttachmentToArchive(attachmentId, messageId)) {
Log.i(TAG, "[" + attachmentId + "] Was previously preuploaded and should now be copied to the archive.");
jobManager.add(new CopyAttachmentToArchiveJob(attachmentId));
}
}
onMessageSent(); onMessageSent();
mmsDatabase.setTransactionSuccessful(); mmsDatabase.setTransactionSuccessful();
} catch (MmsException e) { } catch (MmsException e) {
@@ -442,6 +434,14 @@ public class MessageSender {
mmsDatabase.endTransaction(); mmsDatabase.endTransaction();
} }
for (AttachmentId attachmentId : attachmentsWithPreuploadId) {
long messageId = SignalDatabase.attachments().getMessageId(attachmentId);
if (BackupRepository.shouldCopyAttachmentToArchive(attachmentId, messageId)) {
Log.i(TAG, "[" + attachmentId + "] Was previously preuploaded and should now be copied to the archive.");
jobManager.add(new CopyAttachmentToArchiveJob(attachmentId));
}
}
for (int i = 0; i < messageIds.size(); i++) { for (int i = 0; i < messageIds.size(); i++) {
long messageId = messageIds.get(i); long messageId = messageIds.get(i);
Recipient recipient = messages.get(i).getThreadRecipient(); Recipient recipient = messages.get(i).getThreadRecipient();