AttachmentDownloads: Log second error, finish job even on failures
This commit is contained in:
parent
662223df32
commit
ef20c31c64
1 changed files with 12 additions and 10 deletions
|
@ -226,7 +226,7 @@ async function _maybeStartJob(): Promise<void> {
|
|||
} catch (deleteError) {
|
||||
log.error(
|
||||
`${logId}: Failed to delete attachment job`,
|
||||
Errors.toLogFormat(error)
|
||||
Errors.toLogFormat(deleteError)
|
||||
);
|
||||
} finally {
|
||||
void _maybeStartJob();
|
||||
|
@ -371,16 +371,18 @@ async function _markAttachmentAsFailed(
|
|||
const { id, messageId, attachment, type, index } = job;
|
||||
const message = await _getMessageById(id, messageId);
|
||||
|
||||
if (!message) {
|
||||
return;
|
||||
try {
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
await _addAttachmentToMessage(
|
||||
message,
|
||||
_markAttachmentAsPermanentError(attachment),
|
||||
{ type, index }
|
||||
);
|
||||
} finally {
|
||||
await _finishJob(message, id);
|
||||
}
|
||||
|
||||
await _addAttachmentToMessage(
|
||||
message,
|
||||
_markAttachmentAsPermanentError(attachment),
|
||||
{ type, index }
|
||||
);
|
||||
await _finishJob(message, id);
|
||||
}
|
||||
|
||||
async function _getMessageById(
|
||||
|
|
Loading…
Reference in a new issue