summaryrefslogtreecommitdiff
path: root/packages/backend/src/server
diff options
context:
space:
mode:
authorpiuvas <mail@piuvas.net>2025-01-12 21:11:36 -0300
committerpiuvas <mail@piuvas.net>2025-01-12 21:11:36 -0300
commit3fc377839c6155d1eb3c55ae7eb24e85e4ad90c7 (patch)
tree655a84d661d6046938f65f9abda12653c0adb646 /packages/backend/src/server
parentrequested changes (diff)
downloadsharkey-3fc377839c6155d1eb3c55ae7eb24e85e4ad90c7.tar.gz
sharkey-3fc377839c6155d1eb3c55ae7eb24e85e4ad90c7.tar.bz2
sharkey-3fc377839c6155d1eb3c55ae7eb24e85e4ad90c7.zip
comment :3
Diffstat (limited to 'packages/backend/src/server')
-rw-r--r--packages/backend/src/server/api/stream/channel.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/backend/src/server/api/stream/channel.ts b/packages/backend/src/server/api/stream/channel.ts
index cfac4b30ce..047dedd5ce 100644
--- a/packages/backend/src/server/api/stream/channel.ts
+++ b/packages/backend/src/server/api/stream/channel.ts
@@ -105,8 +105,11 @@ export default abstract class Channel {
public async assignMyReaction(note: Packed<'Note'>, noteEntityService: NoteEntityService): Promise<Packed<'Note'>> {
let changed = false;
- // cloning here seems like the best solution for not sharing changes with other users.
- // where multiple users shared the same myReaction. (Sharkey #877)
+ // StreamingApiServerService creates a single EventEmitter per server process,
+ // so a new note arriving from redis gets de-serialised once per server process,
+ // and then that single object is passed to all active channels on each connection.
+ // If we didn't clone the notes here, different connections would asynchronously write
+ // different values to the same object, resulting in a random value being sent to each frontend. -- Dakkar
const clonedNote = { ...note };
if (this.user && isRenotePacked(note) && !isQuotePacked(note)) {
if (note.renote && Object.keys(note.renote.reactions).length > 0) {