From ab6d3ee4a2b91a09b94714842a863f6fe9fc9b21 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Thu, 26 Jun 2025 13:55:16 -0400 Subject: [PATCH] fix async of GlobalEventService.publishXStream methods --- .../backend/src/core/GlobalEventService.ts | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/backend/src/core/GlobalEventService.ts b/packages/backend/src/core/GlobalEventService.ts index b16e47362d..2be5a580da 100644 --- a/packages/backend/src/core/GlobalEventService.ts +++ b/packages/backend/src/core/GlobalEventService.ts @@ -396,18 +396,18 @@ export class GlobalEventService { } @bindThis - public publishMainStream(userId: MiUser['id'], type: K, value?: MainEventTypes[K]): void { - this.publish(`mainStream:${userId}`, type, typeof value === 'undefined' ? null : value); + public async publishMainStream(userId: MiUser['id'], type: K, value?: MainEventTypes[K]): Promise { + await this.publish(`mainStream:${userId}`, type, typeof value === 'undefined' ? null : value); } @bindThis - public publishDriveStream(userId: MiUser['id'], type: K, value?: DriveEventTypes[K]): void { - this.publish(`driveStream:${userId}`, type, typeof value === 'undefined' ? null : value); + public async publishDriveStream(userId: MiUser['id'], type: K, value?: DriveEventTypes[K]): Promise { + await this.publish(`driveStream:${userId}`, type, typeof value === 'undefined' ? null : value); } @bindThis - public publishNoteStream(noteId: MiNote['id'], type: K, value?: NoteEventTypes[K]): void { - this.publish(`noteStream:${noteId}`, type, { + public async publishNoteStream(noteId: MiNote['id'], type: K, value?: NoteEventTypes[K]): Promise { + await this.publish(`noteStream:${noteId}`, type, { id: noteId, body: value, }); @@ -419,42 +419,42 @@ export class GlobalEventService { } @bindThis - public publishAntennaStream(antennaId: MiAntenna['id'], type: K, value?: AntennaEventTypes[K]): void { - this.publish(`antennaStream:${antennaId}`, type, typeof value === 'undefined' ? null : value); + public async publishAntennaStream(antennaId: MiAntenna['id'], type: K, value?: AntennaEventTypes[K]): Promise { + await this.publish(`antennaStream:${antennaId}`, type, typeof value === 'undefined' ? null : value); } @bindThis - public publishRoleTimelineStream(roleId: MiRole['id'], type: K, value?: RoleTimelineEventTypes[K]): void { - this.publish(`roleTimelineStream:${roleId}`, type, typeof value === 'undefined' ? null : value); + public async publishRoleTimelineStream(roleId: MiRole['id'], type: K, value?: RoleTimelineEventTypes[K]): Promise { + await this.publish(`roleTimelineStream:${roleId}`, type, typeof value === 'undefined' ? null : value); } @bindThis - public publishNotesStream(note: Packed<'Note'>): void { - this.publish('notesStream', null, note); + public async publishNotesStream(note: Packed<'Note'>): Promise { + await this.publish('notesStream', null, note); } @bindThis - public publishAdminStream(userId: MiUser['id'], type: K, value?: AdminEventTypes[K]): void { - this.publish(`adminStream:${userId}`, type, typeof value === 'undefined' ? null : value); + public async publishAdminStream(userId: MiUser['id'], type: K, value?: AdminEventTypes[K]): Promise { + await this.publish(`adminStream:${userId}`, type, typeof value === 'undefined' ? null : value); } @bindThis - public publishChatUserStream(fromUserId: MiUser['id'], toUserId: MiUser['id'], type: K, value?: ChatEventTypes[K]): void { - this.publish(`chatUserStream:${fromUserId}-${toUserId}`, type, typeof value === 'undefined' ? null : value); + public async publishChatUserStream(fromUserId: MiUser['id'], toUserId: MiUser['id'], type: K, value?: ChatEventTypes[K]): Promise { + await this.publish(`chatUserStream:${fromUserId}-${toUserId}`, type, typeof value === 'undefined' ? null : value); } @bindThis - public publishChatRoomStream(toRoomId: MiChatRoom['id'], type: K, value?: ChatEventTypes[K]): void { - this.publish(`chatRoomStream:${toRoomId}`, type, typeof value === 'undefined' ? null : value); + public async publishChatRoomStream(toRoomId: MiChatRoom['id'], type: K, value?: ChatEventTypes[K]): Promise { + await this.publish(`chatRoomStream:${toRoomId}`, type, typeof value === 'undefined' ? null : value); } @bindThis - public publishReversiStream(userId: MiUser['id'], type: K, value?: ReversiEventTypes[K]): void { - this.publish(`reversiStream:${userId}`, type, typeof value === 'undefined' ? null : value); + public async publishReversiStream(userId: MiUser['id'], type: K, value?: ReversiEventTypes[K]): Promise { + await this.publish(`reversiStream:${userId}`, type, typeof value === 'undefined' ? null : value); } @bindThis - public publishReversiGameStream(gameId: MiReversiGame['id'], type: K, value?: ReversiGameEventTypes[K]): void { - this.publish(`reversiGameStream:${gameId}`, type, typeof value === 'undefined' ? null : value); + public async publishReversiGameStream(gameId: MiReversiGame['id'], type: K, value?: ReversiGameEventTypes[K]): Promise { + await this.publish(`reversiGameStream:${gameId}`, type, typeof value === 'undefined' ? null : value); } }