Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix race condition in AsyncCurrentValueSubject #40

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wfltaylor
Copy link

Description

If a value is sent to the subject while handleNewConsumer() is running, it is possible for the new consumer to miss this value. This is because the currentValue is read before the state is updated with the channel. This is addressed by setting the current value at the same point that the channel is added to the state.

Checklist

  • this PR is based on the main branch and is up-to-date, if not please rebase your branch on the top of main
  • the commits inside this PR have explicit commit messages
  • unit tests cover the new feature or the bug fix
  • the feature is documented in the README.md if it makes sense
  • the CHANGELOG is up-to-date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants