fix: retry transient attachment downloads#1951
Open
Ap4sh wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First time contributor checklist:
Contributor checklist:
devbranchDescription
Refs #1748
This fixes attachment downloads that can get stuck after a transient network failure
The old retry path treated the third failed attempt as permanent for every non-404 error. That deleted the download job and marked the message attachment as failed, so there was no background recovery path even when the file was still available
This PR keeps normal attachment jobs retryable with capped backoff, while still treating expired 404s and malformed attachment pointers as terminal. It also preserves the attachment metadata needed for future retries and lets failed image attachments render through the generic attachment fallback
Preview jobs keep the existing shorter retry boundary, so this only extends the retry window for normal attachment jobs
Testing
AttachmentsDownload.start()covering a later transient failure keeping the job queued while showing the attachment as failederrorreaching attachment props without exposing retry metadatapnpm exec prettier --check ts/components/conversation/Image.tsx ts/models/message.ts ts/session/utils/AttachmentDownloadRetry.ts ts/session/utils/AttachmentsDownload.ts ts/test/session/unit/models/MessageModel_test.ts ts/test/session/unit/utils/AttachmentDownloadRetry_test.ts ts/test/session/unit/utils/AttachmentsDownload_test.tspnpm exec eslint ts/components/conversation/Image.tsx ts/models/message.ts ts/session/utils/AttachmentDownloadRetry.ts ts/session/utils/AttachmentsDownload.ts ts/test/session/unit/models/MessageModel_test.ts ts/test/session/unit/utils/AttachmentDownloadRetry_test.ts ts/test/session/unit/utils/AttachmentsDownload_test.tspnpm exec tscpnpm test-copypnpm build-copypnpm build-compilepnpm exec mocha --no-config --exit --require jsdom-global/register --require app/ts/test/test-utils/setup.js app/ts/test/session/unit/utils/AttachmentDownloadRetry_test.js app/ts/test/session/unit/utils/AttachmentsDownload_test.js app/ts/test/session/unit/models/MessageModel_test.jsTargeted Mocha result:
22 passing