aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/videos/refresh.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/videos/refresh.ts')
-rw-r--r--server/lib/activitypub/videos/refresh.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/lib/activitypub/videos/refresh.ts b/server/lib/activitypub/videos/refresh.ts
index da068cde9..71a4e75b0 100644
--- a/server/lib/activitypub/videos/refresh.ts
+++ b/server/lib/activitypub/videos/refresh.ts
@@ -8,8 +8,6 @@ import { HttpStatusCode } from '@shared/core-utils'
8import { fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared' 8import { fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared'
9import { APVideoUpdater } from './updater' 9import { APVideoUpdater } from './updater'
10 10
11const lTags = loggerTagsFactory('ap', 'video', 'refresh')
12
13async function refreshVideoIfNeeded (options: { 11async function refreshVideoIfNeeded (options: {
14 video: MVideoThumbnail 12 video: MVideoThumbnail
15 fetchedType: VideoFetchByUrlType 13 fetchedType: VideoFetchByUrlType
@@ -22,11 +20,13 @@ async function refreshVideoIfNeeded (options: {
22 ? options.video as MVideoAccountLightBlacklistAllFiles 20 ? options.video as MVideoAccountLightBlacklistAllFiles
23 : await VideoModel.loadByUrlAndPopulateAccount(options.video.url) 21 : await VideoModel.loadByUrlAndPopulateAccount(options.video.url)
24 22
23 const lTags = loggerTagsFactory('ap', 'video', 'refresh', video.uuid, video.url)
24
25 try { 25 try {
26 const { videoObject } = await fetchRemoteVideo(video.url) 26 const { videoObject } = await fetchRemoteVideo(video.url)
27 27
28 if (videoObject === undefined) { 28 if (videoObject === undefined) {
29 logger.warn('Cannot refresh remote video %s: invalid body.', video.url, lTags(video.uuid)) 29 logger.warn('Cannot refresh remote video %s: invalid body.', video.url, lTags())
30 30
31 await video.setAsRefreshed() 31 await video.setAsRefreshed()
32 return video 32 return video
@@ -42,14 +42,14 @@ async function refreshVideoIfNeeded (options: {
42 return video 42 return video
43 } catch (err) { 43 } catch (err) {
44 if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) { 44 if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {
45 logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url, lTags(video.uuid)) 45 logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url, lTags())
46 46
47 // Video does not exist anymore 47 // Video does not exist anymore
48 await video.destroy() 48 await video.destroy()
49 return undefined 49 return undefined
50 } 50 }
51 51
52 logger.warn('Cannot refresh video %s.', options.video.url, { err, ...lTags(video.uuid) }) 52 logger.warn('Cannot refresh video %s.', options.video.url, { err, ...lTags() })
53 53
54 ActorFollowScoreCache.Instance.addBadServerId(video.VideoChannel.Actor.serverId) 54 ActorFollowScoreCache.Instance.addBadServerId(video.VideoChannel.Actor.serverId)
55 55