Skip to content

Commit

Permalink
Merge pull request #1496 from oxen-io/revert-attachment-download-list…
Browse files Browse the repository at this point in the history
…-mechanism

[SES-1956] Attachment download job re-start preventer removed
  • Loading branch information
bemusementpark authored May 22, 2024
2 parents 34ae58d + f6fb4ab commit 98f279f
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
private val reverseMessageList = false

private val adapter by lazy {

// To prevent repeated attachment download jobs being spawned for any that fail we'll keep
// track of the attachment Ids we've attempted to download. Without this guard mechanism
// then when the retry limit for a failed job is reached another job is immediately spawned
// to download the same attachment (endlessly).
val alreadyAttemptedAttachmentDownloads = mutableSetOf<Long>()

val cursor = mmsSmsDb.getConversation(viewModel.threadId, reverseMessageList)
val adapter = ConversationAdapter(
this,
Expand Down Expand Up @@ -332,13 +325,8 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
}
},
onAttachmentNeedsDownload = { attachmentId, mmsId ->
alreadyAttemptedAttachmentDownloads.takeUnless {
attachmentId in it
}?.let {
it += attachmentId
lifecycleScope.launch(Dispatchers.IO) {
JobQueue.shared.add(AttachmentDownloadJob(attachmentId, mmsId))
}
lifecycleScope.launch(Dispatchers.IO) {
JobQueue.shared.add(AttachmentDownloadJob(attachmentId, mmsId))
}
},
glide = glide,
Expand Down

0 comments on commit 98f279f

Please sign in to comment.