aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/video.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-02-04 15:45:41 +0100
committerChocobozzz <me@florianbigard.com>2020-02-04 15:58:59 +0100
commit943e5193905908dd1f2800d8810c635d86e3b28f (patch)
tree961973733e6e4afb58ac222d2847a3fc4b6d6d60 /server/helpers/video.ts
parent7eba5e1fa81c8e54cb8fe298a96e8070afa50921 (diff)
downloadPeerTube-943e5193905908dd1f2800d8810c635d86e3b28f.tar.gz
PeerTube-943e5193905908dd1f2800d8810c635d86e3b28f.tar.zst
PeerTube-943e5193905908dd1f2800d8810c635d86e3b28f.zip
Don't refresh videos when processing views
It allows us to use a cache
Diffstat (limited to 'server/helpers/video.ts')
-rw-r--r--server/helpers/video.ts15
1 files changed, 12 insertions, 3 deletions
diff --git a/server/helpers/video.ts b/server/helpers/video.ts
index 907564703..4fe2a60f0 100644
--- a/server/helpers/video.ts
+++ b/server/helpers/video.ts
@@ -38,14 +38,23 @@ function fetchVideo (
38 if (fetchType === 'id' || fetchType === 'none') return VideoModel.loadOnlyId(id) 38 if (fetchType === 'id' || fetchType === 'none') return VideoModel.loadOnlyId(id)
39} 39}
40 40
41type VideoFetchByUrlType = 'all' | 'only-video' 41type VideoFetchByUrlType = 'all' | 'only-video' | 'only-immutable-attributes'
42 42
43function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird<MVideoAccountLightBlacklistAllFiles> 43function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird<MVideoAccountLightBlacklistAllFiles>
44function fetchVideoByUrl (url: string, fetchType: 'only-immutable-attributes'): Bluebird<MVideoImmutable>
44function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird<MVideoThumbnail> 45function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird<MVideoThumbnail>
45function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail> 46function fetchVideoByUrl (
46function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail> { 47 url: string,
48 fetchType: VideoFetchByUrlType
49): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail | MVideoImmutable>
50function fetchVideoByUrl (
51 url: string,
52 fetchType: VideoFetchByUrlType
53): Bluebird<MVideoAccountLightBlacklistAllFiles | MVideoThumbnail | MVideoImmutable> {
47 if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url) 54 if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url)
48 55
56 if (fetchType === 'only-immutable-attributes') return VideoModel.loadByUrlImmutableAttributes(url)
57
49 if (fetchType === 'only-video') return VideoModel.loadByUrl(url) 58 if (fetchType === 'only-video') return VideoModel.loadByUrl(url)
50} 59}
51 60