aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/files-cache/videos-preview-cache.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-30 09:25:17 +0200
committerChocobozzz <me@florianbigard.com>2022-06-30 09:25:17 +0200
commitcd25344f741e8c97b113b36eb6babc7be490114d (patch)
tree83742ef011ea3ea66cba7fefbafa593614215e22 /server/lib/files-cache/videos-preview-cache.ts
parenta4152bed14427ef91f69e11d1a2cd9745aa74408 (diff)
downloadPeerTube-cd25344f741e8c97b113b36eb6babc7be490114d.tar.gz
PeerTube-cd25344f741e8c97b113b36eb6babc7be490114d.tar.zst
PeerTube-cd25344f741e8c97b113b36eb6babc7be490114d.zip
Reduce lazy static error logs
Diffstat (limited to 'server/lib/files-cache/videos-preview-cache.ts')
-rw-r--r--server/lib/files-cache/videos-preview-cache.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/server/lib/files-cache/videos-preview-cache.ts b/server/lib/files-cache/videos-preview-cache.ts
index b7a8d6105..48d2cb52c 100644
--- a/server/lib/files-cache/videos-preview-cache.ts
+++ b/server/lib/files-cache/videos-preview-cache.ts
@@ -37,13 +37,19 @@ class VideosPreviewCache extends AbstractVideoStaticFileCache <string> {
37 37
38 const preview = video.getPreview() 38 const preview = video.getPreview()
39 const destPath = join(FILES_CACHE.PREVIEWS.DIRECTORY, preview.filename) 39 const destPath = join(FILES_CACHE.PREVIEWS.DIRECTORY, preview.filename)
40
41 const remoteUrl = preview.getFileUrl(video) 40 const remoteUrl = preview.getFileUrl(video)
42 await doRequestAndSaveToFile(remoteUrl, destPath)
43 41
44 logger.debug('Fetched remote preview %s to %s.', remoteUrl, destPath) 42 try {
43 await doRequestAndSaveToFile(remoteUrl, destPath)
44
45 logger.debug('Fetched remote preview %s to %s.', remoteUrl, destPath)
46
47 return { isOwned: false, path: destPath }
48 } catch (err) {
49 logger.info('Cannot fetch remote preview file %s.', remoteUrl, { err })
45 50
46 return { isOwned: false, path: destPath } 51 return undefined
52 }
47 } 53 }
48} 54}
49 55