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) {
|
} catch (deleteError) {
|
||||||
log.error(
|
log.error(
|
||||||
`${logId}: Failed to delete attachment job`,
|
`${logId}: Failed to delete attachment job`,
|
||||||
Errors.toLogFormat(error)
|
Errors.toLogFormat(deleteError)
|
||||||
);
|
);
|
||||||
} finally {
|
} finally {
|
||||||
void _maybeStartJob();
|
void _maybeStartJob();
|
||||||
|
@ -371,16 +371,18 @@ async function _markAttachmentAsFailed(
|
||||||
const { id, messageId, attachment, type, index } = job;
|
const { id, messageId, attachment, type, index } = job;
|
||||||
const message = await _getMessageById(id, messageId);
|
const message = await _getMessageById(id, messageId);
|
||||||
|
|
||||||
if (!message) {
|
try {
|
||||||
return;
|
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(
|
async function _getMessageById(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue