X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Flib%2Factivitypub%2Fvideos%2Frefresh.ts;h=da068cde9eec647215394e1729ef6cc06b256353;hb=463206948d6a9d46e7e68d55c7b763e601ecc870;hp=205a3ccb1226e60d96f03f9353d6e20f109bcd9c;hpb=e872632091cbec15da05ce74d89fed4527ab93eb;p=github%2FChocobozzz%2FPeerTube.git 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 @@ -import { logger } from '@server/helpers/logger' +import { logger, loggerTagsFactory } from '@server/helpers/logger' import { PeerTubeRequestError } from '@server/helpers/requests' import { VideoFetchByUrlType } from '@server/helpers/video' import { ActorFollowScoreCache } from '@server/lib/files-cache' @@ -8,6 +8,8 @@ import { HttpStatusCode } from '@shared/core-utils' import { fetchRemoteVideo, SyncParam, syncVideoExternalAttributes } from './shared' import { APVideoUpdater } from './updater' +const lTags = loggerTagsFactory('ap', 'video', 'refresh') + async function refreshVideoIfNeeded (options: { video: MVideoThumbnail fetchedType: VideoFetchByUrlType @@ -24,7 +26,7 @@ async function refreshVideoIfNeeded (options: { const { videoObject } = await fetchRemoteVideo(video.url) if (videoObject === undefined) { - logger.warn('Cannot refresh remote video %s: invalid body.', video.url) + logger.warn('Cannot refresh remote video %s: invalid body.', video.url, lTags(video.uuid)) await video.setAsRefreshed() return video @@ -40,14 +42,14 @@ async function refreshVideoIfNeeded (options: { return video } catch (err) { if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) { - logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url) + logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url, lTags(video.uuid)) // Video does not exist anymore await video.destroy() return undefined } - logger.warn('Cannot refresh video %s.', options.video.url, { err }) + logger.warn('Cannot refresh video %s.', options.video.url, { err, ...lTags(video.uuid) }) ActorFollowScoreCache.Instance.addBadServerId(video.VideoChannel.Actor.serverId)