Ensure that download is no longer pending on abort

This commit is contained in:
Scott Nonnenberg
2025-03-15 05:56:19 +10:00
committed by GitHub
parent ae35eb8e49
commit 46b09ec8d1

View File

@@ -383,6 +383,16 @@ async function runDownloadAttachmentJob({
`${logId}: Cancelled attempt ${job.attempts}. Not scheduling a retry. Error:`,
Errors.toLogFormat(error)
);
// Remove `pending` flag from the attachment. User can retry later.
await addAttachmentToMessage(
message.id,
{
...job.attachment,
pending: false,
},
logId,
{ type: job.attachmentType }
);
return { status: 'finished' };
}