summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NoteCreateService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-04 08:46:27 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-04 08:46:27 +0900
commit17b83ff4c13e873b63262c349ea9c7bade0d656a (patch)
treef4b8e18a2a4d5b5f9c22c53f10ea50a6cf440053 /packages/backend/src/core/NoteCreateService.ts
parentfix: deck uiでuser listを見たときにリプライが表示されない (... (diff)
downloadsharkey-17b83ff4c13e873b63262c349ea9c7bade0d656a.tar.gz
sharkey-17b83ff4c13e873b63262c349ea9c7bade0d656a.tar.bz2
sharkey-17b83ff4c13e873b63262c349ea9c7bade0d656a.zip
enhance: TLキャッシュ容量を設定できるように
Diffstat (limited to 'packages/backend/src/core/NoteCreateService.ts')
-rw-r--r--packages/backend/src/core/NoteCreateService.ts24
1 files changed, 13 insertions, 11 deletions
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts
index 8fb34fd637..7e1c0b5c22 100644
--- a/packages/backend/src/core/NoteCreateService.ts
+++ b/packages/backend/src/core/NoteCreateService.ts
@@ -803,6 +803,8 @@ export class NoteCreateService implements OnApplicationShutdown {
@bindThis
private async pushToTl(note: MiNote, user: { id: MiUser['id']; host: MiUser['host']; }) {
+ const meta = await this.metaService.fetch();
+
const redisPipeline = this.redisForTimelines.pipeline();
if (note.channelId) {
@@ -816,14 +818,14 @@ export class NoteCreateService implements OnApplicationShutdown {
for (const channelFollowing of channelFollowings) {
redisPipeline.xadd(
`homeTimeline:${channelFollowing.followerId}`,
- 'MAXLEN', '~', '200',
+ 'MAXLEN', '~', meta.perUserHomeTimelineCacheMax.toString(),
'*',
'note', note.id);
if (note.fileIds.length > 0) {
redisPipeline.xadd(
`homeTimelineWithFiles:${channelFollowing.followerId}`,
- 'MAXLEN', '~', '100',
+ 'MAXLEN', '~', (meta.perUserHomeTimelineCacheMax / 2).toString(),
'*',
'note', note.id);
}
@@ -855,14 +857,14 @@ export class NoteCreateService implements OnApplicationShutdown {
redisPipeline.xadd(
`homeTimeline:${following.followerId}`,
- 'MAXLEN', '~', '200',
+ 'MAXLEN', '~', meta.perUserHomeTimelineCacheMax.toString(),
'*',
'note', note.id);
if (note.fileIds.length > 0) {
redisPipeline.xadd(
`homeTimelineWithFiles:${following.followerId}`,
- 'MAXLEN', '~', '100',
+ 'MAXLEN', '~', (meta.perUserHomeTimelineCacheMax / 2).toString(),
'*',
'note', note.id);
}
@@ -882,14 +884,14 @@ export class NoteCreateService implements OnApplicationShutdown {
redisPipeline.xadd(
`userListTimeline:${userListMembership.userListId}`,
- 'MAXLEN', '~', '200',
+ 'MAXLEN', '~', meta.perUserListTimelineCacheMax.toString(),
'*',
'note', note.id);
if (note.fileIds.length > 0) {
redisPipeline.xadd(
`userListTimelineWithFiles:${userListMembership.userListId}`,
- 'MAXLEN', '~', '100',
+ 'MAXLEN', '~', (meta.perUserListTimelineCacheMax / 2).toString(),
'*',
'note', note.id);
}
@@ -898,14 +900,14 @@ export class NoteCreateService implements OnApplicationShutdown {
{ // 自分自身のHTL
redisPipeline.xadd(
`homeTimeline:${user.id}`,
- 'MAXLEN', '~', '200',
+ 'MAXLEN', '~', meta.perUserHomeTimelineCacheMax.toString(),
'*',
'note', note.id);
if (note.fileIds.length > 0) {
redisPipeline.xadd(
`homeTimelineWithFiles:${user.id}`,
- 'MAXLEN', '~', '100',
+ 'MAXLEN', '~', (meta.perUserHomeTimelineCacheMax / 2).toString(),
'*',
'note', note.id);
}
@@ -916,20 +918,20 @@ export class NoteCreateService implements OnApplicationShutdown {
if (note.replyId && note.replyUserId !== note.userId) {
redisPipeline.xadd(
`userTimelineWithReplies:${user.id}`,
- 'MAXLEN', '~', '1000',
+ 'MAXLEN', '~', note.userHost == null ? meta.perLocalUserUserTimelineCacheMax.toString() : meta.perRemoteUserUserTimelineCacheMax.toString(),
'*',
'note', note.id);
} else {
redisPipeline.xadd(
`userTimeline:${user.id}`,
- 'MAXLEN', '~', '1000',
+ 'MAXLEN', '~', note.userHost == null ? meta.perLocalUserUserTimelineCacheMax.toString() : meta.perRemoteUserUserTimelineCacheMax.toString(),
'*',
'note', note.id);
if (note.fileIds.length > 0) {
redisPipeline.xadd(
`userTimelineWithFiles:${user.id}`,
- 'MAXLEN', '~', '500',
+ 'MAXLEN', '~', note.userHost == null ? (meta.perLocalUserUserTimelineCacheMax / 2).toString() : (meta.perRemoteUserUserTimelineCacheMax / 2).toString(),
'*',
'note', note.id);
}