aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-19 14:44:20 +0200
committerChocobozzz <me@florianbigard.com>2018-09-19 15:22:55 +0200
commite587e0ecee5bec43a225995948faaa4bc97f080a (patch)
tree6348e28eb06086d0c8586ceb91230b4a4af67053 /server/models/activitypub
parentd4defe07d26013a75577b30608841fe3f8334308 (diff)
downloadPeerTube-e587e0ecee5bec43a225995948faaa4bc97f080a.tar.gz
PeerTube-e587e0ecee5bec43a225995948faaa4bc97f080a.tar.zst
PeerTube-e587e0ecee5bec43a225995948faaa4bc97f080a.zip
Optimize activity actor load in AP processors
Diffstat (limited to 'server/models/activitypub')
-rw-r--r--server/models/activitypub/actor.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts
index 69c2eca57..f8bb59323 100644
--- a/server/models/activitypub/actor.ts
+++ b/server/models/activitypub/actor.ts
@@ -327,6 +327,29 @@ export class ActorModel extends Model<ActorModel> {
327 where: { 327 where: {
328 url 328 url
329 }, 329 },
330 transaction,
331 include: [
332 {
333 attributes: [ 'id' ],
334 model: AccountModel.unscoped(),
335 required: false
336 },
337 {
338 attributes: [ 'id' ],
339 model: VideoChannelModel.unscoped(),
340 required: false
341 }
342 ]
343 }
344
345 return ActorModel.unscoped().findOne(query)
346 }
347
348 static loadByUrlAndPopulateAccountAndChannel (url: string, transaction?: Sequelize.Transaction) {
349 const query = {
350 where: {
351 url
352 },
330 transaction 353 transaction
331 } 354 }
332 355