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
Dima Krasner
Sharkey
Commits
329830e2
Commit
329830e2
authored
1 year ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
perf(backend): tweak populateMyReaction
parent
061e3893
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/backend/src/core/entities/NoteEntityService.ts
+4
-4
4 additions, 4 deletions
packages/backend/src/core/entities/NoteEntityService.ts
with
4 additions
and
4 deletions
packages/backend/src/core/entities/NoteEntityService.ts
+
4
−
4
View file @
329830e2
...
...
@@ -180,8 +180,8 @@ export class NoteEntityService implements OnModuleInit {
// 実装上抜けがあるだけかもしれないので、「ヒントに含まれてなかったら(=undefinedなら)return」のようにはしない
}
// パフォーマンスのためノートが作成されてから
1
秒以上経っていない場合はリアクションを取得しない
if
(
note
.
createdAt
.
getTime
()
+
1
000
>
Date
.
now
())
{
// パフォーマンスのためノートが作成されてから
2
秒以上経っていない場合はリアクションを取得しない
if
(
note
.
createdAt
.
getTime
()
+
2
000
>
Date
.
now
())
{
return
undefined
;
}
...
...
@@ -382,8 +382,8 @@ export class NoteEntityService implements OnModuleInit {
const
myReactionsMap
=
new
Map
<
MiNote
[
'
id
'
],
MiNoteReaction
|
null
>
();
if
(
meId
)
{
const
renoteIds
=
notes
.
filter
(
n
=>
n
.
renoteId
!=
null
).
map
(
n
=>
n
.
renoteId
!
);
// パフォーマンスのためノートが作成されてから
1
秒以上経っていない場合はリアクションを取得しない
const
targets
=
[...
notes
.
filter
(
n
=>
n
.
createdAt
.
getTime
()
+
1
000
<
Date
.
now
()).
map
(
n
=>
n
.
id
),
...
renoteIds
];
// パフォーマンスのためノートが作成されてから
2
秒以上経っていない場合はリアクションを取得しない
const
targets
=
[...
notes
.
filter
(
n
=>
n
.
createdAt
.
getTime
()
+
2
000
<
Date
.
now
()).
map
(
n
=>
n
.
id
),
...
renoteIds
];
const
myReactions
=
await
this
.
noteReactionsRepository
.
findBy
({
userId
:
meId
,
noteId
:
In
(
targets
),
...
...
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