summaryrefslogtreecommitdiff
path: root/packages/backend/src
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
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')
-rw-r--r--packages/backend/src/server/api/stream/Connection.ts21
-rw-r--r--packages/backend/src/server/api/stream/channels/antenna.ts2
-rw-r--r--packages/backend/src/server/api/stream/channels/bubble-timeline.ts2
-rw-r--r--packages/backend/src/server/api/stream/channels/channel.ts2
-rw-r--r--packages/backend/src/server/api/stream/channels/global-timeline.ts2
-rw-r--r--packages/backend/src/server/api/stream/channels/hashtag.ts2
-rw-r--r--packages/backend/src/server/api/stream/channels/home-timeline.ts2
-rw-r--r--packages/backend/src/server/api/stream/channels/hybrid-timeline.ts2
-rw-r--r--packages/backend/src/server/api/stream/channels/local-timeline.ts2
-rw-r--r--packages/backend/src/server/api/stream/channels/main.ts2
-rw-r--r--packages/backend/src/server/api/stream/channels/role-timeline.ts2
-rw-r--r--packages/backend/src/server/api/stream/channels/user-list.ts2
12 files changed, 0 insertions, 43 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();
}
}
diff --git a/packages/backend/src/server/api/stream/channels/antenna.ts b/packages/backend/src/server/api/stream/channels/antenna.ts
index a73d158b7f..0974dbdb25 100644
--- a/packages/backend/src/server/api/stream/channels/antenna.ts
+++ b/packages/backend/src/server/api/stream/channels/antenna.ts
@@ -43,8 +43,6 @@ class AntennaChannel extends Channel {
if (this.isNoteMutedOrBlocked(note)) return;
- this.connection.cacheNote(note);
-
this.send('note', note);
} else {
this.send(data.type, data.body);
diff --git a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts
index 5ebbdcbb86..38561aae15 100644
--- a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts
@@ -66,8 +66,6 @@ class BubbleTimelineChannel extends Channel {
const clonedNote = await this.assignMyReaction(note);
await this.hideNote(clonedNote);
- this.connection.cacheNote(clonedNote);
-
this.send('note', clonedNote);
}
diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts
index ec0bc7e13a..65fb8d67cb 100644
--- a/packages/backend/src/server/api/stream/channels/channel.ts
+++ b/packages/backend/src/server/api/stream/channels/channel.ts
@@ -52,8 +52,6 @@ class ChannelChannel extends Channel {
const clonedNote = await this.assignMyReaction(note);
await this.hideNote(clonedNote);
- this.connection.cacheNote(clonedNote);
-
this.send('note', clonedNote);
}
diff --git a/packages/backend/src/server/api/stream/channels/global-timeline.ts b/packages/backend/src/server/api/stream/channels/global-timeline.ts
index 72a8a8b156..1b4dca3089 100644
--- a/packages/backend/src/server/api/stream/channels/global-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/global-timeline.ts
@@ -63,8 +63,6 @@ class GlobalTimelineChannel extends Channel {
const clonedNote = await this.assignMyReaction(note);
await this.hideNote(clonedNote);
- this.connection.cacheNote(clonedNote);
-
this.send('note', clonedNote);
}
diff --git a/packages/backend/src/server/api/stream/channels/hashtag.ts b/packages/backend/src/server/api/stream/channels/hashtag.ts
index 7c8df87721..f47a10f293 100644
--- a/packages/backend/src/server/api/stream/channels/hashtag.ts
+++ b/packages/backend/src/server/api/stream/channels/hashtag.ts
@@ -48,8 +48,6 @@ class HashtagChannel extends Channel {
const clonedNote = await this.assignMyReaction(note);
await this.hideNote(clonedNote);
- this.connection.cacheNote(clonedNote);
-
this.send('note', clonedNote);
}
diff --git a/packages/backend/src/server/api/stream/channels/home-timeline.ts b/packages/backend/src/server/api/stream/channels/home-timeline.ts
index c87a21be82..dfdb491113 100644
--- a/packages/backend/src/server/api/stream/channels/home-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/home-timeline.ts
@@ -84,8 +84,6 @@ class HomeTimelineChannel extends Channel {
const clonedNote = await this.assignMyReaction(note);
await this.hideNote(clonedNote);
- this.connection.cacheNote(clonedNote);
-
this.send('note', clonedNote);
}
diff --git a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts
index 95b762e2b7..6cb425ff81 100644
--- a/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/hybrid-timeline.ts
@@ -101,8 +101,6 @@ class HybridTimelineChannel extends Channel {
const clonedNote = await this.assignMyReaction(note);
await this.hideNote(clonedNote);
- this.connection.cacheNote(clonedNote);
-
this.send('note', clonedNote);
}
diff --git a/packages/backend/src/server/api/stream/channels/local-timeline.ts b/packages/backend/src/server/api/stream/channels/local-timeline.ts
index b9e0a4c234..2c31aab66d 100644
--- a/packages/backend/src/server/api/stream/channels/local-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/local-timeline.ts
@@ -73,8 +73,6 @@ class LocalTimelineChannel extends Channel {
const clonedNote = await this.assignMyReaction(note);
await this.hideNote(clonedNote);
- this.connection.cacheNote(clonedNote);
-
this.send('note', clonedNote);
}
diff --git a/packages/backend/src/server/api/stream/channels/main.ts b/packages/backend/src/server/api/stream/channels/main.ts
index 6b144e43e4..6194bb78dd 100644
--- a/packages/backend/src/server/api/stream/channels/main.ts
+++ b/packages/backend/src/server/api/stream/channels/main.ts
@@ -39,7 +39,6 @@ class MainChannel extends Channel {
const note = await this.noteEntityService.pack(data.body.note.id, this.user, {
detail: true,
});
- this.connection.cacheNote(note);
data.body.note = note;
}
break;
@@ -52,7 +51,6 @@ class MainChannel extends Channel {
const note = await this.noteEntityService.pack(data.body.id, this.user, {
detail: true,
});
- this.connection.cacheNote(note);
data.body = note;
}
break;
diff --git a/packages/backend/src/server/api/stream/channels/role-timeline.ts b/packages/backend/src/server/api/stream/channels/role-timeline.ts
index 14c4d96479..78cd9bf868 100644
--- a/packages/backend/src/server/api/stream/channels/role-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/role-timeline.ts
@@ -51,8 +51,6 @@ class RoleTimelineChannel extends Channel {
const clonedNote = await this.assignMyReaction(note);
await this.hideNote(clonedNote);
- this.connection.cacheNote(clonedNote);
-
this.send('note', clonedNote);
} else {
this.send(data.type, data.body);
diff --git a/packages/backend/src/server/api/stream/channels/user-list.ts b/packages/backend/src/server/api/stream/channels/user-list.ts
index d09a9b8d9f..8a7c2b2633 100644
--- a/packages/backend/src/server/api/stream/channels/user-list.ts
+++ b/packages/backend/src/server/api/stream/channels/user-list.ts
@@ -114,8 +114,6 @@ class UserListChannel extends Channel {
const clonedNote = await this.assignMyReaction(note);
await this.hideNote(clonedNote);
- this.connection.cacheNote(clonedNote);
-
this.send('note', clonedNote);
}