diff --git a/SessionMessagingKit/Jobs/Types/MessageSendJob.swift b/SessionMessagingKit/Jobs/Types/MessageSendJob.swift index eac85ddfb..d0e062153 100644 --- a/SessionMessagingKit/Jobs/Types/MessageSendJob.swift +++ b/SessionMessagingKit/Jobs/Types/MessageSendJob.swift @@ -31,7 +31,16 @@ public enum MessageSendJob: JobExecutor { // so extract them from any associated attachments var messageFileIds: [String] = [] - if details.message is VisibleMessage { + /// Ensure any associated attachments have already been uploaded before sending the message + /// + /// **Note:** Reactions reference their original message so we need to ignore this logic for reaction messages to ensure we don't + /// incorrectly re-upload incoming attachments that the user reacted to, we also want to exclude "sync" messages since they should + /// already have attachments in a valid state + if + details.message is VisibleMessage, + (details.message as? VisibleMessage)?.reaction == nil && + details.isSyncMessage == false + { guard let jobId: Int64 = job.id, let interactionId: Int64 = job.interactionId diff --git a/SessionUtilitiesKit/JobRunner/JobRunner.swift b/SessionUtilitiesKit/JobRunner/JobRunner.swift index 25d352a1d..948fc9d80 100644 --- a/SessionUtilitiesKit/JobRunner/JobRunner.swift +++ b/SessionUtilitiesKit/JobRunner/JobRunner.swift @@ -528,6 +528,11 @@ private final class JobQueue { } queue.mutate { $0.append(job) } + + // If this is a concurrent queue then we should immediately start the next job + guard executionType == .concurrent else { return } + + runNextJob() } /// Upsert a job onto the queue, if the queue isn't currently running and 'canStartJob' is true then this will start