summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/stream/Connection.ts
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-04-01 12:28:16 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-04-01 12:28:16 -0400
commit2e2ae21a09d28084d511c6d4d31896f2fdda8a3e (patch)
treedcac78cd95bb1239c2f8ab35009d05607ecbc109 /packages/backend/src/server/api/stream/Connection.ts
parentreplace email validation regex with a simpler alternative (diff)
downloadsharkey-2e2ae21a09d28084d511c6d4d31896f2fdda8a3e.tar.gz
sharkey-2e2ae21a09d28084d511c6d4d31896f2fdda8a3e.tar.bz2
sharkey-2e2ae21a09d28084d511c6d4d31896f2fdda8a3e.zip
remove no-op Connection.cachedNotes and Connection.cacheNote
Diffstat (limited to 'packages/backend/src/server/api/stream/Connection.ts')
-rw-r--r--packages/backend/src/server/api/stream/Connection.ts21
1 files changed, 0 insertions, 21 deletions
diff --git a/packages/backend/src/server/api/stream/Connection.ts b/packages/backend/src/server/api/stream/Connection.ts
index ed0c789c1f..1ed2e5e9a5 100644
--- a/packages/backend/src/server/api/stream/Connection.ts
+++ b/packages/backend/src/server/api/stream/Connection.ts
@@ -36,8 +36,6 @@ export default class Connection {
public subscriber: StreamEventEmitter;
private channels = new Map<string, Channel>();
private subscribingNotes = new Map<string, number>();
- // TODO see if we should remove this, now that it has no more reads
- private cachedNotes = new Map<string, Packed<'Note'>>();
public userProfile: MiUserProfile | null = null;
public following: Record<string, Pick<MiFollowing, 'withReplies'> | undefined> = {};
public followingChannels: Set<string> = new Set();
@@ -156,24 +154,6 @@ export default class Connection {
}
@bindThis
- public cacheNote(note: Packed<'Note'>) {
- const add = (note: Packed<'Note'>) => {
- this.cachedNotes.set(note.id, note);
-
- while (this.cachedNotes.size > MAX_CACHED_NOTES_PER_CONNECTION) {
- // Map maintains insertion order, so first key is always the oldest
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- const oldestKey = this.cachedNotes.keys().next().value!;
- this.cachedNotes.delete(oldestKey);
- }
- };
-
- add(note);
- if (note.reply) add(note.reply);
- if (note.renote) add(note.renote);
- }
-
- @bindThis
private onReadNotification(payload: JsonValue | undefined) {
this.notificationService.readAllNotification(this.user!.id);
}
@@ -371,6 +351,5 @@ export default class Connection {
this.fetchIntervalId = null;
this.channels.clear();
this.subscribingNotes.clear();
- this.cachedNotes.clear();
}
}