aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/redundancy.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-26 11:01:59 +0200
committerChocobozzz <me@florianbigard.com>2021-08-26 11:02:41 +0200
commit52b1fd15fa9e2cc04873ad606e789929579483f2 (patch)
treed270a71715af407cc93771a39014f62facf710df /server/lib/redundancy.ts
parent7b6cf83e33c1cf9719f77338288b9145b8cdcf60 (diff)
downloadPeerTube-52b1fd15fa9e2cc04873ad606e789929579483f2.tar.gz
PeerTube-52b1fd15fa9e2cc04873ad606e789929579483f2.tar.zst
PeerTube-52b1fd15fa9e2cc04873ad606e789929579483f2.zip
Better logs for redundancy
Diffstat (limited to 'server/lib/redundancy.ts')
-rw-r--r--server/lib/redundancy.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/server/lib/redundancy.ts b/server/lib/redundancy.ts
index 2a9241249..2613d01be 100644
--- a/server/lib/redundancy.ts
+++ b/server/lib/redundancy.ts
@@ -1,5 +1,5 @@
1import { Transaction } from 'sequelize' 1import { Transaction } from 'sequelize'
2import { logger } from '@server/helpers/logger' 2import { logger, loggerTagsFactory } from '@server/helpers/logger'
3import { CONFIG } from '@server/initializers/config' 3import { CONFIG } from '@server/initializers/config'
4import { ActorFollowModel } from '@server/models/actor/actor-follow' 4import { ActorFollowModel } from '@server/models/actor/actor-follow'
5import { getServerActor } from '@server/models/application/application' 5import { getServerActor } from '@server/models/application/application'
@@ -8,6 +8,8 @@ import { Activity } from '@shared/models'
8import { VideoRedundancyModel } from '../models/redundancy/video-redundancy' 8import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'
9import { sendUndoCacheFile } from './activitypub/send' 9import { sendUndoCacheFile } from './activitypub/send'
10 10
11const lTags = loggerTagsFactory('redundancy')
12
11async function removeVideoRedundancy (videoRedundancy: MVideoRedundancyVideo, t?: Transaction) { 13async function removeVideoRedundancy (videoRedundancy: MVideoRedundancyVideo, t?: Transaction) {
12 const serverActor = await getServerActor() 14 const serverActor = await getServerActor()
13 15
@@ -28,7 +30,7 @@ async function removeRedundanciesOfServer (serverId: number) {
28async function isRedundancyAccepted (activity: Activity, byActor: MActorSignature) { 30async function isRedundancyAccepted (activity: Activity, byActor: MActorSignature) {
29 const configAcceptFrom = CONFIG.REMOTE_REDUNDANCY.VIDEOS.ACCEPT_FROM 31 const configAcceptFrom = CONFIG.REMOTE_REDUNDANCY.VIDEOS.ACCEPT_FROM
30 if (configAcceptFrom === 'nobody') { 32 if (configAcceptFrom === 'nobody') {
31 logger.info('Do not accept remote redundancy %s due instance accept policy.', activity.id) 33 logger.info('Do not accept remote redundancy %s due instance accept policy.', activity.id, lTags())
32 return false 34 return false
33 } 35 }
34 36
@@ -37,7 +39,10 @@ async function isRedundancyAccepted (activity: Activity, byActor: MActorSignatur
37 const allowed = await ActorFollowModel.isFollowedBy(byActor.id, serverActor.id) 39 const allowed = await ActorFollowModel.isFollowedBy(byActor.id, serverActor.id)
38 40
39 if (allowed !== true) { 41 if (allowed !== true) {
40 logger.info('Do not accept remote redundancy %s because actor %s is not followed by our instance.', activity.id, byActor.url) 42 logger.info(
43 'Do not accept remote redundancy %s because actor %s is not followed by our instance.',
44 activity.id, byActor.url, lTags()
45 )
41 return false 46 return false
42 } 47 }
43 } 48 }