aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/actors/refresh.ts
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/actors/refresh.ts
parent7ffa92d6e4e49fc81fc40489302c46ac84f94b92 (diff)
downloadPeerTube-9de33c6bd9580ab43cc7bc089c54b2fe2bdfd72d.tar.gz
PeerTube-9de33c6bd9580ab43cc7bc089c54b2fe2bdfd72d.tar.zst
PeerTube-9de33c6bd9580ab43cc7bc089c54b2fe2bdfd72d.zip
Add logs for refresh functions
Diffstat (limited to 'server/lib/activitypub/actors/refresh.ts')
-rw-r--r--server/lib/activitypub/actors/refresh.ts10
1 files changed, 7 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}