Relax federation logs

pull/6562/head
Chocobozzz 2024-08-13 09:11:52 +02:00
parent 90275e5e03
commit 766f2cb76a
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 14 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import { fetchAP, getAPId } from './activity.js'
import { getOrCreateAPActor } from './actors/index.js'
import { sendUndoAnnounce, sendVideoAnnounce } from './send/index.js'
import { checkUrlsSameHost, getLocalVideoAnnounceActivityPubUrl } from './url.js'
import { HttpStatusCode } from '@peertube/peertube-models'
const lTags = loggerTagsFactory('share')
@ -32,7 +33,12 @@ export async function addVideoShares (shareUrls: string[], video: MVideoId) {
try {
await addVideoShare(shareUrl, video)
} catch (err) {
logger.warn('Cannot add share %s.', shareUrl, { err })
if (err.statusCode === HttpStatusCode.NOT_FOUND_404 || err.statusCode === HttpStatusCode.GONE_410) {
logger.debug(`Cannot add share ${shareUrl} that does not exist anymore`, { err })
return
}
logger.info(`Cannot add share ${shareUrl}`, { err })
}
}, { concurrency: CRAWL_REQUEST_CONCURRENCY })
}

View File

@ -1,4 +1,4 @@
import { VideoCommentPolicy } from '@peertube/peertube-models'
import { HttpStatusCode, VideoCommentPolicy } from '@peertube/peertube-models'
import Bluebird from 'bluebird'
import { sanitizeAndCheckVideoCommentObject } from '../../helpers/custom-validators/activitypub/video-comments.js'
import { logger } from '../../helpers/logger.js'
@ -34,7 +34,12 @@ export async function addVideoComments (commentUrls: string[]) {
try {
await resolveThread({ url: commentUrl, isVideo: false })
} catch (err) {
logger.warn('Cannot resolve thread %s.', commentUrl, { err })
if (err.statusCode === HttpStatusCode.NOT_FOUND_404 || err.statusCode === HttpStatusCode.GONE_410) {
logger.debug(`Cannot resolve thread ${commentUrl} that does not exist anymore`, { err })
return
}
logger.info(`Cannot resolve thread ${commentUrl}`, { err })
}
}, { concurrency: CRAWL_REQUEST_CONCURRENCY })
}