Do not add dependencies on previous message sends if you have no media.

This was an accidental carry-over from the PushMediaSendJob ->
IndividualSendJob rename.

Previously, PushMediaSendJob basically always had media, so this check
wasn't needed. Now it rarely has media, so we have to add it.
This commit is contained in:
Greyson Parrelli
2023-04-03 11:14:41 -04:00
committed by Alex Hart
parent e0be9b4ef5
commit 3231f8302c
2 changed files with 13 additions and 3 deletions

View File

@@ -106,9 +106,14 @@ public class IndividualSendJob extends PushSendJob {
ApplicationDependencies.getScheduledMessageManager().scheduleIfNecessary();
return;
}
Set<String> attachmentUploadIds = enqueueCompressingAndUploadAttachmentsChains(jobManager, message);
jobManager.add(IndividualSendJob.create(messageId, recipient, attachmentUploadIds.size() > 0, isScheduledSend), attachmentUploadIds, isScheduledSend ? null : recipient.getId().toQueueKey());
Set<String> attachmentUploadIds = enqueueCompressingAndUploadAttachmentsChains(jobManager, message);
boolean hasMedia = attachmentUploadIds.size() > 0;
boolean addHardDependencies = hasMedia && !isScheduledSend;
jobManager.add(IndividualSendJob.create(messageId, recipient, hasMedia, isScheduledSend),
attachmentUploadIds,
addHardDependencies ? recipient.getId().toQueueKey() : null);
} catch (NoSuchMessageException | MmsException e) {
Log.w(TAG, "Failed to enqueue message.", e);
SignalDatabase.messages().markAsSentFailed(messageId);

View File

@@ -136,7 +136,12 @@ public final class PushGroupSendJob extends PushSendJob {
throw new MmsException("Inactive group!");
}
jobManager.add(new PushGroupSendJob(messageId, destination, filterAddresses, !attachmentUploadIds.isEmpty(), isScheduledSend), attachmentUploadIds, attachmentUploadIds.isEmpty() || isScheduledSend ? null : destination.toQueueKey());
boolean hasMedia = attachmentUploadIds.size() > 0;
boolean addHardDependencies = hasMedia && !isScheduledSend;
jobManager.add(new PushGroupSendJob(messageId, destination, filterAddresses, hasMedia, isScheduledSend),
attachmentUploadIds,
addHardDependencies ? destination.toQueueKey() : null);
} catch (NoSuchMessageException | MmsException e) {
Log.w(TAG, "Failed to enqueue message.", e);