perf(timeline): Optimizing for CDN Caching (MisskeyIO#834)
Co-authored-by: あわわわとーにゅ <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
parent
3362c464c5
commit
4ecfae0d85
13 changed files with 205 additions and 27 deletions
|
@ -19,6 +19,7 @@ class LocalTimelineChannel extends Channel {
|
|||
private withRenotes: boolean;
|
||||
private withReplies: boolean;
|
||||
private withFiles: boolean;
|
||||
private idOnly: boolean;
|
||||
|
||||
constructor(
|
||||
private metaService: MetaService,
|
||||
|
@ -40,6 +41,7 @@ class LocalTimelineChannel extends Channel {
|
|||
this.withRenotes = params.withRenotes ?? true;
|
||||
this.withReplies = params.withReplies ?? false;
|
||||
this.withFiles = params.withFiles ?? false;
|
||||
this.idOnly = params.idOnly ?? false;
|
||||
|
||||
// Subscribe events
|
||||
this.subscriber.on('notesStream', this.onNote);
|
||||
|
@ -88,9 +90,13 @@ class LocalTimelineChannel extends Channel {
|
|||
}
|
||||
}
|
||||
|
||||
this.connection.cacheNote(note);
|
||||
|
||||
this.send('note', note);
|
||||
if (this.idOnly && ['public', 'home'].includes(note.visibility)) {
|
||||
const idOnlyNote = { id: note.id };
|
||||
this.send('note', idOnlyNote);
|
||||
} else {
|
||||
this.connection.cacheNote(note);
|
||||
this.send('note', note);
|
||||
}
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue