Erased messages should not stall attachment jobs
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
parent
ab86217a5c
commit
719cd6467f
|
@ -286,12 +286,15 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise<void> {
|
|||
Errors.toLogFormat(error)
|
||||
);
|
||||
|
||||
try {
|
||||
await _addAttachmentToMessage(
|
||||
message,
|
||||
_markAttachmentAsTransientError(attachment),
|
||||
{ type, index }
|
||||
);
|
||||
} finally {
|
||||
await _finishJob(message, id);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -302,6 +305,7 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise<void> {
|
|||
Errors.toLogFormat(error)
|
||||
);
|
||||
|
||||
try {
|
||||
// Remove `pending` flag from the attachment.
|
||||
await _addAttachmentToMessage(
|
||||
message,
|
||||
|
@ -326,9 +330,11 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise<void> {
|
|||
};
|
||||
|
||||
await saveAttachmentDownloadJob(failedJob);
|
||||
} finally {
|
||||
delete _activeAttachmentDownloadJobs[id];
|
||||
_maybeStartJob();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function _finishJob(
|
||||
|
|
Loading…
Reference in New Issue