mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Optimize AP fetch
This commit is contained in:
parent
11a554cfcf
commit
a2f99b54df
4 changed files with 13 additions and 5 deletions
|
@ -8,12 +8,16 @@ import { Notifier } from '../../notifier'
|
|||
import { logger } from '../../../helpers/logger'
|
||||
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
|
||||
import { MActorSignature, MVideoAccountLightBlacklistAllFiles } from '../../../types/models'
|
||||
import { getAPId } from '@server/helpers/activitypub'
|
||||
|
||||
async function processAnnounceActivity (options: APProcessorOptions<ActivityAnnounce>) {
|
||||
const { activity, byActor: actorAnnouncer } = options
|
||||
// Only notify if it is not from a fetcher job
|
||||
const notify = options.fromFetch !== true
|
||||
|
||||
// Announces on accounts are not supported
|
||||
if (actorAnnouncer.type !== 'Application' && actorAnnouncer.type !== 'Group') return
|
||||
|
||||
return retryTransactionWrapper(processVideoShare, actorAnnouncer, activity, notify)
|
||||
}
|
||||
|
||||
|
@ -26,7 +30,7 @@ export {
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function processVideoShare (actorAnnouncer: MActorSignature, activity: ActivityAnnounce, notify: boolean) {
|
||||
const objectUri = typeof activity.object === 'string' ? activity.object : activity.object.id
|
||||
const objectUri = getAPId(activity.object)
|
||||
|
||||
let video: MVideoAccountLightBlacklistAllFiles
|
||||
let videoCreated: boolean
|
||||
|
|
|
@ -28,6 +28,9 @@ async function processCreateActivity (options: APProcessorOptions<ActivityCreate
|
|||
}
|
||||
|
||||
if (activityType === 'Note') {
|
||||
// Comments will be fetched from videos
|
||||
if (options.fromFetch) return
|
||||
|
||||
return retryTransactionWrapper(processCreateVideoComment, activity, byActor, notify)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue