diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-26 11:01:59 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-26 11:02:41 +0200 |
commit | 52b1fd15fa9e2cc04873ad606e789929579483f2 (patch) | |
tree | d270a71715af407cc93771a39014f62facf710df /server/lib/redundancy.ts | |
parent | 7b6cf83e33c1cf9719f77338288b9145b8cdcf60 (diff) | |
download | PeerTube-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.ts | 11 |
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 @@ | |||
1 | import { Transaction } from 'sequelize' | 1 | import { Transaction } from 'sequelize' |
2 | import { logger } from '@server/helpers/logger' | 2 | import { logger, loggerTagsFactory } from '@server/helpers/logger' |
3 | import { CONFIG } from '@server/initializers/config' | 3 | import { CONFIG } from '@server/initializers/config' |
4 | import { ActorFollowModel } from '@server/models/actor/actor-follow' | 4 | import { ActorFollowModel } from '@server/models/actor/actor-follow' |
5 | import { getServerActor } from '@server/models/application/application' | 5 | import { getServerActor } from '@server/models/application/application' |
@@ -8,6 +8,8 @@ import { Activity } from '@shared/models' | |||
8 | import { VideoRedundancyModel } from '../models/redundancy/video-redundancy' | 8 | import { VideoRedundancyModel } from '../models/redundancy/video-redundancy' |
9 | import { sendUndoCacheFile } from './activitypub/send' | 9 | import { sendUndoCacheFile } from './activitypub/send' |
10 | 10 | ||
11 | const lTags = loggerTagsFactory('redundancy') | ||
12 | |||
11 | async function removeVideoRedundancy (videoRedundancy: MVideoRedundancyVideo, t?: Transaction) { | 13 | async 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) { | |||
28 | async function isRedundancyAccepted (activity: Activity, byActor: MActorSignature) { | 30 | async 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 | } |