Erased messages should not stall attachment jobs
This commit is contained in:
@@ -286,12 +286,15 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise<void> {
|
|||||||
Errors.toLogFormat(error)
|
Errors.toLogFormat(error)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
await _addAttachmentToMessage(
|
await _addAttachmentToMessage(
|
||||||
message,
|
message,
|
||||||
_markAttachmentAsTransientError(attachment),
|
_markAttachmentAsTransientError(attachment),
|
||||||
{ type, index }
|
{ type, index }
|
||||||
);
|
);
|
||||||
|
} finally {
|
||||||
await _finishJob(message, id);
|
await _finishJob(message, id);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -302,6 +305,7 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise<void> {
|
|||||||
Errors.toLogFormat(error)
|
Errors.toLogFormat(error)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
// Remove `pending` flag from the attachment.
|
// Remove `pending` flag from the attachment.
|
||||||
await _addAttachmentToMessage(
|
await _addAttachmentToMessage(
|
||||||
message,
|
message,
|
||||||
@@ -326,9 +330,11 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise<void> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
await saveAttachmentDownloadJob(failedJob);
|
await saveAttachmentDownloadJob(failedJob);
|
||||||
|
} finally {
|
||||||
delete _activeAttachmentDownloadJobs[id];
|
delete _activeAttachmentDownloadJobs[id];
|
||||||
_maybeStartJob();
|
_maybeStartJob();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _finishJob(
|
async function _finishJob(
|
||||||
|
Reference in New Issue
Block a user