reorder relay activities to avoid delivery race condition

This commit is contained in:
Hazelnoot 2025-05-05 17:44:00 -04:00
parent d39a56c1b7
commit c302a5c2d7
11 changed files with 40 additions and 44 deletions

View file

@ -90,10 +90,7 @@ export class PollService {
}
@bindThis
public async deliverQuestionUpdate(noteId: MiNote['id']) {
const note = await this.notesRepository.findOneBy({ id: noteId });
if (note == null) throw new Error('note not found');
public async deliverQuestionUpdate(note: MiNote) {
if (note.localOnly) return;
const user = await this.usersRepository.findOneBy({ id: note.userId });
@ -101,8 +98,8 @@ export class PollService {
if (this.userEntityService.isLocalUser(user)) {
const content = this.apRendererService.addContext(this.apRendererService.renderUpdate(await this.apRendererService.renderNote(note, user, false), user));
this.apDeliverManagerService.deliverToFollowers(user, content);
this.relayService.deliverToRelays(user, content);
await this.apDeliverManagerService.deliverToFollowers(user, content);
await this.relayService.deliverToRelays(user, content);
}
}
}