aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-08 16:19:09 +0200
committerChocobozzz <me@florianbigard.com>2021-06-08 16:22:23 +0200
commit9de33c6bd9580ab43cc7bc089c54b2fe2bdfd72d (patch)
tree795dd6b9fc53f8d50a212f1a052cca5719bf14a7 /server/lib/activitypub
parent7ffa92d6e4e49fc81fc40489302c46ac84f94b92 (diff)
downloadPeerTube-9de33c6bd9580ab43cc7bc089c54b2fe2bdfd72d.tar.gz
PeerTube-9de33c6bd9580ab43cc7bc089c54b2fe2bdfd72d.tar.zst
PeerTube-9de33c6bd9580ab43cc7bc089c54b2fe2bdfd72d.zip
Add logs for refresh functions
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r--server/lib/activitypub/actors/refresh.ts10
-rw-r--r--server/lib/activitypub/playlists/refresh.ts2
-rw-r--r--server/lib/activitypub/videos/refresh.ts2
3 files changed, 11 insertions, 3 deletions
diff --git a/server/lib/activitypub/actors/refresh.ts b/server/lib/activitypub/actors/refresh.ts
index 9758649a5..1f7cfcd8f 100644
--- a/server/lib/activitypub/actors/refresh.ts
+++ b/server/lib/activitypub/actors/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 { ActorLoadByUrlType } from '@server/lib/model-loaders' 3import { ActorLoadByUrlType } from '@server/lib/model-loaders'
4import { ActorModel } from '@server/models/actor/actor' 4import { ActorModel } from '@server/models/actor/actor'
@@ -19,6 +19,10 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannel
19 ? actorArg as MActorFull 19 ? actorArg as MActorFull
20 : await ActorModel.loadByUrlAndPopulateAccountAndChannel(actorArg.url) 20 : await ActorModel.loadByUrlAndPopulateAccountAndChannel(actorArg.url)
21 21
22 const lTags = loggerTagsFactory('ap', 'actor', 'refresh', actor.url)
23
24 logger.info('Refreshing actor %s.', actor.url, lTags())
25
22 try { 26 try {
23 const actorUrl = await getActorUrl(actor) 27 const actorUrl = await getActorUrl(actor)
24 const { actorObject } = await fetchRemoteActor(actorUrl) 28 const { actorObject } = await fetchRemoteActor(actorUrl)
@@ -34,7 +38,7 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannel
34 return { refreshed: true, actor } 38 return { refreshed: true, actor }
35 } catch (err) { 39 } catch (err) {
36 if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) { 40 if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {
37 logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url) 41 logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url, lTags())
38 42
39 actor.Account 43 actor.Account
40 ? await actor.Account.destroy() 44 ? await actor.Account.destroy()
@@ -43,7 +47,7 @@ async function refreshActorIfNeeded <T extends MActorFull | MActorAccountChannel
43 return { actor: undefined, refreshed: false } 47 return { actor: undefined, refreshed: false }
44 } 48 }
45 49
46 logger.warn('Cannot refresh actor %s.', actor.url, { err }) 50 logger.warn('Cannot refresh actor %s.', actor.url, { err, ...lTags() })
47 return { actor, refreshed: false } 51 return { actor, refreshed: false }
48 } 52 }
49} 53}
diff --git a/server/lib/activitypub/playlists/refresh.ts b/server/lib/activitypub/playlists/refresh.ts
index ff9e5471a..6f3a6be37 100644
--- a/server/lib/activitypub/playlists/refresh.ts
+++ b/server/lib/activitypub/playlists/refresh.ts
@@ -10,6 +10,8 @@ async function refreshVideoPlaylistIfNeeded (videoPlaylist: MVideoPlaylistOwner)
10 10
11 const lTags = loggerTagsFactory('ap', 'video-playlist', 'refresh', videoPlaylist.uuid, videoPlaylist.url) 11 const lTags = loggerTagsFactory('ap', 'video-playlist', 'refresh', videoPlaylist.uuid, videoPlaylist.url)
12 12
13 logger.info('Refreshing playlist %s.', videoPlaylist.url, lTags())
14
13 try { 15 try {
14 const { playlistObject } = await fetchRemoteVideoPlaylist(videoPlaylist.url) 16 const { playlistObject } = await fetchRemoteVideoPlaylist(videoPlaylist.url)
15 17
diff --git a/server/lib/activitypub/videos/refresh.ts b/server/lib/activitypub/videos/refresh.ts
index 82b3b13bf..a7b82f286 100644
--- a/server/lib/activitypub/videos/refresh.ts
+++ b/server/lib/activitypub/videos/refresh.ts
@@ -22,6 +22,8 @@ async function refreshVideoIfNeeded (options: {
22 22
23 const lTags = loggerTagsFactory('ap', 'video', 'refresh', video.uuid, video.url) 23 const lTags = loggerTagsFactory('ap', 'video', 'refresh', video.uuid, video.url)
24 24
25 logger.info('Refreshing video %s.', video.url, lTags())
26
25 try { 27 try {
26 const { videoObject } = await fetchRemoteVideo(video.url) 28 const { videoObject } = await fetchRemoteVideo(video.url)
27 29