diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-18 12:00:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-19 09:54:37 +0200 |
commit | 627621c1e8d37c33f7b3dd59f4c8907b12c630bc (patch) | |
tree | 007e7118f482c543d3898b222b62c185fda4fd2b /server/lib/cache/videos-preview-cache.ts | |
parent | e972e046dbe9b499944c4fab9220eee13e31ac1b (diff) | |
download | PeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.tar.gz PeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.tar.zst PeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.zip |
Optimize SQL requests of watch page API endpoints
Diffstat (limited to 'server/lib/cache/videos-preview-cache.ts')
-rw-r--r-- | server/lib/cache/videos-preview-cache.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/server/lib/cache/videos-preview-cache.ts b/server/lib/cache/videos-preview-cache.ts index 22b6d9cb0..a5d6f5b62 100644 --- a/server/lib/cache/videos-preview-cache.ts +++ b/server/lib/cache/videos-preview-cache.ts | |||
@@ -16,7 +16,7 @@ class VideosPreviewCache extends AbstractVideoStaticFileCache <string> { | |||
16 | } | 16 | } |
17 | 17 | ||
18 | async getFilePath (videoUUID: string) { | 18 | async getFilePath (videoUUID: string) { |
19 | const video = await VideoModel.loadByUUID(videoUUID) | 19 | const video = await VideoModel.loadByUUIDWithFile(videoUUID) |
20 | if (!video) return undefined | 20 | if (!video) return undefined |
21 | 21 | ||
22 | if (video.isOwned()) return join(CONFIG.STORAGE.PREVIEWS_DIR, video.getPreviewName()) | 22 | if (video.isOwned()) return join(CONFIG.STORAGE.PREVIEWS_DIR, video.getPreviewName()) |
@@ -25,7 +25,7 @@ class VideosPreviewCache extends AbstractVideoStaticFileCache <string> { | |||
25 | } | 25 | } |
26 | 26 | ||
27 | protected async loadRemoteFile (key: string) { | 27 | protected async loadRemoteFile (key: string) { |
28 | const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(key) | 28 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(key) |
29 | if (!video) return undefined | 29 | if (!video) return undefined |
30 | 30 | ||
31 | if (video.isOwned()) throw new Error('Cannot load remote preview of owned video.') | 31 | if (video.isOwned()) throw new Error('Cannot load remote preview of owned video.') |