ActivityPub-federated video streaming platform using P2P directly in your web browser
Add logs for refresh functions
Chocobozzz9de33c6bd958
diff --git a/server/lib/activitypub/actors/refresh.ts b/server/lib/activitypub/actors/refresh.tsindex 9758649a56..1f7cfcd8fb 100644--- a/server/lib/activitypub/actors/refresh.ts+++ b/server/lib/activitypub/actors/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 { ActorLoadByUrlType } from '@server/lib/model-loaders'import { ActorModel } from '@server/models/actor/actor'@@ -19,6 +19,10 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannel? actorArg as MActorFull: await ActorModel.loadByUrlAndPopulateAccountAndChannel(actorArg.url)+ const lTags = loggerTagsFactory('ap', 'actor', 'refresh', actor.url)++ logger.info('Refreshing actor %s.', actor.url, lTags())+try {const actorUrl = await getActorUrl(actor)const { actorObject } = await fetchRemoteActor(actorUrl)@@ -34,7 +38,7 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannelreturn { refreshed: true, actor }} catch (err) {if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {- logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url)+ logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url, lTags())actor.Account? await actor.Account.destroy()@@ -43,7 +47,7 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannelreturn { actor: undefined, refreshed: false }}- logger.warn('Cannot refresh actor %s.', actor.url, { err })+ logger.warn('Cannot refresh actor %s.', actor.url, { err, ...lTags() })return { actor, refreshed: false }}}diff --git a/server/lib/activitypub/playlists/refresh.ts b/server/lib/activitypub/playlists/refresh.tsindex ff9e5471a3..6f3a6be37f 100644--- a/server/lib/activitypub/playlists/refresh.ts+++ b/server/lib/activitypub/playlists/refresh.ts@@ -10,6 +10,8 @@ async function refreshVideoPlaylistIfNeeded (videoPlaylist: MVideoPlaylistOwner)const lTags = loggerTagsFactory('ap', 'video-playlist', 'refresh', videoPlaylist.uuid, videoPlaylist.url)+ logger.info('Refreshing playlist %s.', videoPlaylist.url, lTags())+try {const { playlistObject } = await fetchRemoteVideoPlaylist(videoPlaylist.url)diff --git a/server/lib/activitypub/videos/refresh.ts b/server/lib/activitypub/videos/refresh.tsindex 82b3b13bfb..a7b82f2863 100644--- a/server/lib/activitypub/videos/refresh.ts+++ b/server/lib/activitypub/videos/refresh.ts@@ -22,6 +22,8 @@ async function refreshVideoIfNeeded (options: {const lTags = loggerTagsFactory('ap', 'video', 'refresh', video.uuid, video.url)+ logger.info('Refreshing video %s.', video.url, lTags())+try {const { videoObject } = await fetchRemoteVideo(video.url)diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.tsindex b767d38c7a..793abbcb42 100644--- a/server/tests/api/moderation/blocklist.ts+++ b/server/tests/api/moderation/blocklist.ts@@ -215,7 +215,7 @@ describe('Test blocklist', function () {const threads: VideoComment[] = resThreads.body.dataexpect(threads).to.have.lengthOf(1)- expect(threads[0].totalReplies).to.equal(0)+ expect(threads[0].totalReplies).to.equal(1)const t = threads.find(t => t.text === 'comment user 1')expect(t).to.be.undefined@@ -565,7 +565,7 @@ describe('Test blocklist', function () {threads = threads.filter(t => t.isDeleted === false)expect(threads).to.have.lengthOf(1)- expect(threads[0].totalReplies).to.equal(0)+ expect(threads[0].totalReplies).to.equal(1)const t = threads.find(t => t.text === 'comment user 1')expect(t).to.be.undefineddiff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.tsindex e1c062020b..9e5aa00c75 100644--- a/server/tests/api/server/follows.ts+++ b/server/tests/api/server/follows.ts@@ -519,7 +519,7 @@ describe('Test follows', function () {expect(deletedComment.text).to.equal('')expect(deletedComment.inReplyToCommentId).to.be.nullexpect(deletedComment.account).to.be.null- expect(deletedComment.totalReplies).to.equal(3)+ expect(deletedComment.totalReplies).to.equal(2)expect(dateIsValid(deletedComment.deletedAt as string)).to.be.trueconst res2 = await getVideoThreadComments(servers[0].url, video4.id, deletedComment.threadId)