diff options
author | Chocobozzz <me@florianbigard.com> | 2018-11-19 11:24:31 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-11-19 14:34:36 +0100 |
commit | a8a63227781c6815532cb7a68699b08fdb0368be (patch) | |
tree | 6383e14156012b9366d0d1c2039262574fab2fc4 /server/lib/activitypub | |
parent | 9d0b856e930ee1c676d16a56408a3e4a18f8f978 (diff) | |
download | PeerTube-a8a63227781c6815532cb7a68699b08fdb0368be.tar.gz PeerTube-a8a63227781c6815532cb7a68699b08fdb0368be.tar.zst PeerTube-a8a63227781c6815532cb7a68699b08fdb0368be.zip |
Optimize image resizing
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/videos.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 80de92f24..6ff9baefe 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts | |||
@@ -242,10 +242,6 @@ async function updateVideoFromAP (options: { | |||
242 | if (options.updateViews === true) options.video.set('views', videoData.views) | 242 | if (options.updateViews === true) options.video.set('views', videoData.views) |
243 | await options.video.save(sequelizeOptions) | 243 | await options.video.save(sequelizeOptions) |
244 | 244 | ||
245 | // Don't block on request | ||
246 | generateThumbnailFromUrl(options.video, options.videoObject.icon) | ||
247 | .catch(err => logger.warn('Cannot generate thumbnail of %s.', options.videoObject.id, { err })) | ||
248 | |||
249 | { | 245 | { |
250 | const videoFileAttributes = videoFileActivityUrlToDBAttributes(options.video, options.videoObject) | 246 | const videoFileAttributes = videoFileActivityUrlToDBAttributes(options.video, options.videoObject) |
251 | const newVideoFiles = videoFileAttributes.map(a => new VideoFileModel(a)) | 247 | const newVideoFiles = videoFileAttributes.map(a => new VideoFileModel(a)) |
@@ -293,6 +289,12 @@ async function updateVideoFromAP (options: { | |||
293 | logger.debug('Cannot update the remote video.', { err }) | 289 | logger.debug('Cannot update the remote video.', { err }) |
294 | throw err | 290 | throw err |
295 | } | 291 | } |
292 | |||
293 | try { | ||
294 | await generateThumbnailFromUrl(options.video, options.videoObject.icon) | ||
295 | } catch (err) { | ||
296 | logger.warn('Cannot generate thumbnail of %s.', options.videoObject.id, { err }) | ||
297 | } | ||
296 | } | 298 | } |
297 | 299 | ||
298 | export { | 300 | export { |