Skip to content

Commit

Permalink
Relax federation logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Aug 13, 2024
1 parent 90275e5 commit 766f2cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 7 additions & 1 deletion server/core/lib/activitypub/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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 })
}
Expand Down
9 changes: 7 additions & 2 deletions server/core/lib/activitypub/video-comments.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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 })
}
Expand Down

0 comments on commit 766f2cb

Please sign in to comment.