mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Improve logging when falling back to transit tier for attachment downloads
This commit is contained in:
@@ -751,7 +751,7 @@ export async function runDownloadAttachmentJobInner({
|
||||
!preferBackupThumbnail
|
||||
) {
|
||||
log.error(
|
||||
`${logId}: failed to download fullsize attachment, falling back to thumbnail`,
|
||||
`${logId}: failed to download fullsize attachment, falling back to backup thumbnail`,
|
||||
Errors.toLogFormat(error)
|
||||
);
|
||||
try {
|
||||
|
||||
@@ -90,18 +90,29 @@ export async function downloadAttachment({
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
const shouldFallbackToTransitTier =
|
||||
variant !== AttachmentVariant.ThumbnailFromBackup;
|
||||
|
||||
if (error instanceof HTTPError && error.code === 404) {
|
||||
// This is an expected occurrence if restoring from a backup before the
|
||||
// attachment has been moved to the backup tier
|
||||
log.warn(`${logId}: attachment not found on backup CDN`);
|
||||
log.warn(
|
||||
`${logId}: attachment not found on backup CDN`,
|
||||
shouldFallbackToTransitTier ? 'will try transit tier' : ''
|
||||
);
|
||||
} else {
|
||||
// We also just log this error instead of throwing, since we want to still try to
|
||||
// find it on the attachment tier.
|
||||
log.error(
|
||||
`${logId}: error when downloading from backup CDN; will try transit tier`,
|
||||
`${logId}: error when downloading from backup CDN`,
|
||||
shouldFallbackToTransitTier ? 'will try transit tier' : '',
|
||||
toLogFormat(error)
|
||||
);
|
||||
}
|
||||
|
||||
if (!shouldFallbackToTransitTier) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user