Meteor-Community-Packages / meteor-publish-composite

Meteor.publishComposite provides a flexible way to publish a set of related documents from various collections using a reactive join
https://atmospherejs.com/reywood/publish-composite
MIT License
553 stars 58 forks source link

fixed race condition waiting for documents to be added #179

Closed redabourial closed 6 months ago

redabourial commented 6 months ago

What

Waiting for documents to get added results in a race condition. this bug

Why

I narrowed down to this promise and how it is awaited here. I have no idea why it results in a race condition, but it does please see here. I suspect it has to do with the publication instantiation here. The fix is to keep track of children publications and to await them recursively. It seems to fix the issue.

StorytellerCZ commented 6 months ago

Releasing in v1.8.7