From 943e5193905908dd1f2800d8810c635d86e3b28f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Feb 2020 15:45:41 +0100 Subject: Don't refresh videos when processing views It allows us to use a cache --- server/helpers/video.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'server/helpers') 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 ( if (fetchType === 'id' || fetchType === 'none') return VideoModel.loadOnlyId(id) } -type VideoFetchByUrlType = 'all' | 'only-video' +type VideoFetchByUrlType = 'all' | 'only-video' | 'only-immutable-attributes' function fetchVideoByUrl (url: string, fetchType: 'all'): Bluebird +function fetchVideoByUrl (url: string, fetchType: 'only-immutable-attributes'): Bluebird function fetchVideoByUrl (url: string, fetchType: 'only-video'): Bluebird -function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird -function fetchVideoByUrl (url: string, fetchType: VideoFetchByUrlType): Bluebird { +function fetchVideoByUrl ( + url: string, + fetchType: VideoFetchByUrlType +): Bluebird +function fetchVideoByUrl ( + url: string, + fetchType: VideoFetchByUrlType +): Bluebird { if (fetchType === 'all') return VideoModel.loadByUrlAndPopulateAccount(url) + if (fetchType === 'only-immutable-attributes') return VideoModel.loadByUrlImmutableAttributes(url) + if (fetchType === 'only-video') return VideoModel.loadByUrl(url) } -- cgit v1.2.3