chore: 自分へのリプライのみ走査するように (#12570)

This commit is contained in:
anatawa12 2023-12-04 17:56:48 +09:00 committed by GitHub
parent 33034b0e02
commit bb38e62ae6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View file

@ -17,6 +17,7 @@ export type FanoutTimelineName =
| `localTimeline` // replies are not included | `localTimeline` // replies are not included
| `localTimelineWithFiles` // only non-reply notes with files are included | `localTimelineWithFiles` // only non-reply notes with files are included
| `localTimelineWithReplies` // only replies are included | `localTimelineWithReplies` // only replies are included
| `localTimelineWithReplyTo:${string}` // Only replies to specific local user are included. Parameter is reply user id.
// antenna // antenna
| `antennaTimeline:${string}` | `antennaTimeline:${string}`

View file

@ -933,6 +933,9 @@ export class NoteCreateService implements OnApplicationShutdown {
if (note.visibility === 'public' && note.userHost == null) { if (note.visibility === 'public' && note.userHost == null) {
this.fanoutTimelineService.push('localTimelineWithReplies', note.id, 300, r); this.fanoutTimelineService.push('localTimelineWithReplies', note.id, 300, r);
if (note.replyUserHost == null) {
this.fanoutTimelineService.push(`localTimelineWithReplyTo:${note.replyUserId}`, note.id, 300 / 10, r);
}
} }
} else { } else {
this.fanoutTimelineService.push(`userTimeline:${user.id}`, note.id, note.userHost == null ? meta.perLocalUserUserTimelineCacheMax : meta.perRemoteUserUserTimelineCacheMax, r); this.fanoutTimelineService.push(`userTimeline:${user.id}`, note.id, note.userHost == null ? meta.perLocalUserUserTimelineCacheMax : meta.perRemoteUserUserTimelineCacheMax, r);

View file

@ -42,7 +42,7 @@ export const meta = {
bothWithRepliesAndWithFiles: { bothWithRepliesAndWithFiles: {
message: 'Specifying both withReplies and withFiles is not supported', message: 'Specifying both withReplies and withFiles is not supported',
code: 'BOTH_WITH_REPLIES_AND_WITH_FILES', code: 'BOTH_WITH_REPLIES_AND_WITH_FILES',
id: 'dd9c8400-1cb5-4eef-8a31-200c5f933793' id: 'dd9c8400-1cb5-4eef-8a31-200c5f933793',
}, },
}, },
} as const; } as const;
@ -116,9 +116,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
allowPartial: ps.allowPartial, allowPartial: ps.allowPartial,
me, me,
useDbFallback: serverSettings.enableFanoutTimelineDbFallback, useDbFallback: serverSettings.enableFanoutTimelineDbFallback,
redisTimelines: ps.withFiles ? ['localTimelineWithFiles'] : ['localTimeline', 'localTimelineWithReplies'], redisTimelines:
ps.withFiles ? ['localTimelineWithFiles']
: ps.withReplies ? ['localTimeline', 'localTimelineWithReplies']
: me ? ['localTimeline', `localTimelineWithReplyTo:${me.id}`]
: ['localTimeline'],
alwaysIncludeMyNotes: true, alwaysIncludeMyNotes: true,
excludeReplies: !ps.withReplies,
excludePureRenotes: !ps.withRenotes, excludePureRenotes: !ps.withRenotes,
dbFallback: async (untilId, sinceId, limit) => await this.getFromDb({ dbFallback: async (untilId, sinceId, limit) => await this.getFromDb({
untilId, untilId,