diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-03 17:12:38 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-03 17:12:38 +0200 |
commit | 5e08989ede1a340b9edb94465a11b1e04bf24094 (patch) | |
tree | 6fd88e51fea190c74877d86412cca41fedebf53c /server/lib | |
parent | 908e6ead78cc0a42545645be1610024d2ae65746 (diff) | |
download | PeerTube-5e08989ede1a340b9edb94465a11b1e04bf24094.tar.gz PeerTube-5e08989ede1a340b9edb94465a11b1e04bf24094.tar.zst PeerTube-5e08989ede1a340b9edb94465a11b1e04bf24094.zip |
Add tags to AP rate logger
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/video-rates.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/lib/activitypub/video-rates.ts b/server/lib/activitypub/video-rates.ts index 0eec806f9..53ae1780b 100644 --- a/server/lib/activitypub/video-rates.ts +++ b/server/lib/activitypub/video-rates.ts | |||
@@ -3,7 +3,7 @@ import { Transaction } from 'sequelize' | |||
3 | import { doJSONRequest } from '@server/helpers/requests' | 3 | import { doJSONRequest } from '@server/helpers/requests' |
4 | import { VideoRateType } from '../../../shared/models/videos' | 4 | import { VideoRateType } from '../../../shared/models/videos' |
5 | import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' | 5 | import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' |
6 | import { logger } from '../../helpers/logger' | 6 | import { logger, loggerTagsFactory } from '../../helpers/logger' |
7 | import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants' | 7 | import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants' |
8 | import { AccountVideoRateModel } from '../../models/account/account-video-rate' | 8 | import { AccountVideoRateModel } from '../../models/account/account-video-rate' |
9 | import { MAccountActor, MActorUrl, MVideo, MVideoAccountLight, MVideoId } from '../../types/models' | 9 | import { MAccountActor, MActorUrl, MVideo, MVideoAccountLight, MVideoId } from '../../types/models' |
@@ -12,12 +12,14 @@ import { sendLike, sendUndoDislike, sendUndoLike } from './send' | |||
12 | import { sendDislike } from './send/send-dislike' | 12 | import { sendDislike } from './send/send-dislike' |
13 | import { getVideoDislikeActivityPubUrlByLocalActor, getVideoLikeActivityPubUrlByLocalActor } from './url' | 13 | import { getVideoDislikeActivityPubUrlByLocalActor, getVideoLikeActivityPubUrlByLocalActor } from './url' |
14 | 14 | ||
15 | const lTags = loggerTagsFactory('ap', 'video-rate', 'create') | ||
16 | |||
15 | async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateType) { | 17 | async function createRates (ratesUrl: string[], video: MVideo, rate: VideoRateType) { |
16 | await Bluebird.map(ratesUrl, async rateUrl => { | 18 | await Bluebird.map(ratesUrl, async rateUrl => { |
17 | try { | 19 | try { |
18 | await createRate(rateUrl, video, rate) | 20 | await createRate(rateUrl, video, rate) |
19 | } catch (err) { | 21 | } catch (err) { |
20 | logger.warn('Cannot add rate %s.', rateUrl, { err }) | 22 | logger.warn('Cannot add rate %s.', rateUrl, { err, ...lTags(rateUrl, video.uuid, video.url) }) |
21 | } | 23 | } |
22 | }, { concurrency: CRAWL_REQUEST_CONCURRENCY }) | 24 | }, { concurrency: CRAWL_REQUEST_CONCURRENCY }) |
23 | } | 25 | } |