Don't mark attachments archived when a copy to the archive CDN fails.

This commit is contained in:
Greyson Parrelli
2026-09-30 13:34:01 -03:00
committed by Alex Hart
parent 635c997516
commit 0030366ade
2 changed files with 6 additions and 4 deletions
@@ -4564,7 +4564,7 @@ class AttachmentTable(
appendLine("Media names with thumbnails count: $mediaNamesWithThumbnailsCount")
appendLine("Pending attachment upload bytes: $pendingAttachmentUploadBytes")
appendLine("Last snapshot full-size count: $lastSnapshotFullSizeCount")
appendLine("Last snapshot thumbnail count : $lastSnapshotFullSizeCount")
appendLine("Last snapshot thumbnail count : $lastSnapshotThumbnailCount")
appendLine("Uploaded attachment bytes: $uploadedAttachmentBytes")
appendLine("Uploaded thumbnail bytes: $uploadedThumbnailBytes")
appendLine("Total upload count: $totalUploadCount")
@@ -4592,7 +4592,7 @@ class AttachmentTable(
appendLine("Total unique data files: $totalUniqueDataFiles")
appendLine("Total unique media names: $totalUniqueMediaNames")
appendLine("Last snapshot full-size count: $lastSnapshotFullSizeCount")
appendLine("Last snapshot thumbnail count : $lastSnapshotFullSizeCount")
appendLine("Last snapshot thumbnail count : $lastSnapshotThumbnailCount")
appendLine("Pending attachment upload bytes: $pendingAttachmentUploadBytes")
if (archiveStatusMediaNameCounts.isNotEmpty()) {
@@ -187,13 +187,15 @@ class CopyAttachmentToArchiveJob private constructor(private val attachmentId: A
Log.w(TAG, "[$attachmentId]$mediaIdLog Something is invalid about our request. Possibly the length. Scheduling a re-upload.")
setArchiveTransferStateWithDelayedNotification(attachmentId, AttachmentTable.ArchiveTransferState.NONE)
AppDependencies.jobManager.add(UploadAttachmentToArchiveJob(attachmentId, canReuseUpload = false))
Result.success()
// Returning immediately to avoid marking the attachment as finished.
return Result.success()
}
is ArchiveError.CopyMediaError.SourceNotFound -> {
Log.w(TAG, "[$attachmentId]$mediaIdLog The attachment no longer exists on the transit tier. Scheduling a re-upload.")
setArchiveTransferStateWithDelayedNotification(attachmentId, AttachmentTable.ArchiveTransferState.NONE)
AppDependencies.jobManager.add(UploadAttachmentToArchiveJob(attachmentId, canReuseUpload = false))
Result.success()
// Returning immediately to avoid marking the attachment as finished.
return Result.success()
}
is ArchiveError.CopyMediaError.OutOfRemoteSpace -> {
Log.w(TAG, "[$attachmentId]$mediaIdLog Insufficient storage space! Can't upload!")