Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Charlotte
Sharkey
Commits
3cac8e0f
Commit
3cac8e0f
authored
3 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
perf(server): improve deliver performance
parent
bc2c40a6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/backend/src/remote/activitypub/deliver-manager.ts
+18
-7
18 additions, 7 deletions
packages/backend/src/remote/activitypub/deliver-manager.ts
with
18 additions
and
7 deletions
packages/backend/src/remote/activitypub/deliver-manager.ts
+
18
−
7
View file @
3cac8e0f
import
{
Users
,
Followings
}
from
'
@/models/index.js
'
;
import
{
ILocalUser
,
IRemoteUser
,
User
}
from
'
@/models/entities/user.js
'
;
import
{
deliver
}
from
'
@/queue/index.js
'
;
import
{
IsNull
,
Not
}
from
'
typeorm
'
;
//#region types
interface
IRecipe
{
...
...
@@ -82,15 +83,25 @@ export default class DeliverManager {
for
(
const
recipe
of
this
.
recipes
)
{
if
(
isFollowers
(
recipe
))
{
// followers deliver
const
followers
=
await
Followings
.
findBy
({
followeeId
:
this
.
actor
.
id
,
});
// TODO: SELECT DISTINCT ON ("followerSharedInbox") "followerSharedInbox" みたいな問い合わせにすればよりパフォーマンス向上できそう
// ただ、sharedInboxがnullなリモートユーザーも稀におり、その対応ができなさそう?
const
followers
=
await
Followings
.
find
({
where
:
{
followeeId
:
this
.
actor
.
id
,
followerHost
:
Not
(
IsNull
()),
},
select
:
{
followerSharedInbox
:
true
,
followerInbox
:
true
,
},
})
as
{
followerSharedInbox
:
string
|
null
;
followerInbox
:
string
;
}[];
for
(
const
following
of
followers
)
{
if
(
Followings
.
isRemoteFollower
(
following
))
{
const
inbox
=
following
.
followerSharedInbox
||
following
.
followerInbox
;
inboxes
.
add
(
inbox
);
}
const
inbox
=
following
.
followerSharedInbox
||
following
.
followerInbox
;
inboxes
.
add
(
inbox
);
}
}
else
if
(
isDirect
(
recipe
))
{
// direct deliver
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment