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, 6 insertions, 4 deletions
diff --git a/server/lib/activitypub/videos/refresh.ts b/server/lib/activitypub/videos/refresh.ts
index 205a3ccb1..da068cde9 100644
--- a/server/lib/activitypub/videos/refresh.ts
+++ b/server/lib/activitypub/videos/refresh.ts
@@ -1,4 +1,4 @@
1import { logger } from '@server/helpers/logger' 1import { logger, loggerTagsFactory } from '@server/helpers/logger'
2import { PeerTubeRequestError } from '@server/helpers/requests' 2import { PeerTubeRequestError } from '@server/helpers/requests'
3import { VideoFetchByUrlType } from '@server/helpers/video' 3import { VideoFetchByUrlType } from '@server/helpers/video'
4import { ActorFollowScoreCache } from '@server/lib/files-cache' 4import { ActorFollowScoreCache } from '@server/lib/files-cache'
@@ -8,6 +8,8 @@ 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
11async function refreshVideoIfNeeded (options: { 13async function refreshVideoIfNeeded (options: {
12 video: MVideoThumbnail 14 video: MVideoThumbnail
13 fetchedType: VideoFetchByUrlType 15 fetchedType: VideoFetchByUrlType
@@ -24,7 +26,7 @@ async function refreshVideoIfNeeded (options: {
24 const { videoObject } = await fetchRemoteVideo(video.url) 26 const { videoObject } = await fetchRemoteVideo(video.url)
25 27
26 if (videoObject === undefined) { 28 if (videoObject === undefined) {
27 logger.warn('Cannot refresh remote video %s: invalid body.', video.url) 29 logger.warn('Cannot refresh remote video %s: invalid body.', video.url, lTags(video.uuid))
28 30
29 await video.setAsRefreshed() 31 await video.setAsRefreshed()
30 return video 32 return video
@@ -40,14 +42,14 @@ async function refreshVideoIfNeeded (options: {
40 return video 42 return video
41 } catch (err) { 43 } catch (err) {
42 if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) { 44 if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {
43 logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url) 45 logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url, lTags(video.uuid))
44 46
45 // Video does not exist anymore 47 // Video does not exist anymore
46 await video.destroy() 48 await video.destroy()
47 return undefined 49 return undefined
48 } 50 }
49 51
50 logger.warn('Cannot refresh video %s.', options.video.url, { err }) 52 logger.warn('Cannot refresh video %s.', options.video.url, { err, ...lTags(video.uuid) })
51 53
52 ActorFollowScoreCache.Instance.addBadServerId(video.VideoChannel.Actor.serverId) 54 ActorFollowScoreCache.Instance.addBadServerId(video.VideoChannel.Actor.serverId)
53 55