From 2e2ae21a09d28084d511c6d4d31896f2fdda8a3e Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Tue, 1 Apr 2025 12:28:16 -0400 Subject: remove no-op Connection.cachedNotes and Connection.cacheNote --- .../backend/src/server/api/stream/Connection.ts | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'packages/backend/src/server/api/stream/Connection.ts') 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(); private subscribingNotes = new Map(); - // TODO see if we should remove this, now that it has no more reads - private cachedNotes = new Map>(); public userProfile: MiUserProfile | null = null; public following: Record | undefined> = {}; public followingChannels: Set = new Set(); @@ -155,24 +153,6 @@ export default class Connection { this.sendMessageToWs(data.type, data.body); } - @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(); } } -- cgit v1.2.3-freya