synchronize collapsed queues across the cluster to avoid data races
This commit is contained in:
parent
1cb21b0911
commit
896a364de7
13 changed files with 174 additions and 95 deletions
|
|
@ -587,7 +587,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
if (isRemoteUser(user)) {
|
||||
this.federatedInstanceService.fetchOrRegister(user.host).then(async i => {
|
||||
if (!this.isRenote(note) || this.isQuote(note)) {
|
||||
this.collapsedQueueService.updateInstanceQueue.enqueue(i.id, { notesCountDelta: 1 });
|
||||
await this.collapsedQueueService.updateInstanceQueue.enqueue(i.id, { notesCountDelta: 1 });
|
||||
}
|
||||
if (this.meta.enableChartsForFederatedInstances) {
|
||||
this.instanceChart.updateNote(i.host, note, true);
|
||||
|
|
@ -605,10 +605,10 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
|
||||
if (!this.isRenote(note) || this.isQuote(note)) {
|
||||
// Increment notes count (user)
|
||||
this.collapsedQueueService.updateUserQueue.enqueue(user.id, { notesCountDelta: 1 });
|
||||
await this.collapsedQueueService.updateUserQueue.enqueue(user.id, { notesCountDelta: 1 });
|
||||
}
|
||||
|
||||
this.collapsedQueueService.updateUserQueue.enqueue(user.id, { updatedAt: new Date() });
|
||||
await this.collapsedQueueService.updateUserQueue.enqueue(user.id, { updatedAt: new Date() });
|
||||
|
||||
await this.pushToTl(note, user);
|
||||
|
||||
|
|
@ -618,7 +618,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
}, user);
|
||||
|
||||
if (data.reply) {
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(data.reply.id, { repliesCountDelta: 1 });
|
||||
await this.collapsedQueueService.updateNoteQueue.enqueue(data.reply.id, { repliesCountDelta: 1 });
|
||||
}
|
||||
|
||||
if (data.reply == null) {
|
||||
|
|
@ -647,7 +647,7 @@ export class NoteCreateService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
if (this.isPureRenote(data)) {
|
||||
this.collapsedQueueService.updateNoteQueue.enqueue(data.renote.id, { renoteCountDelta: 1 });
|
||||
await this.collapsedQueueService.updateNoteQueue.enqueue(data.renote.id, { renoteCountDelta: 1 });
|
||||
await this.incRenoteCount(data.renote, user);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue