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 a scenario which enqueued events are left unprocessed. #21

Merged
merged 1 commit into from
Aug 12, 2020

Conversation

andersio
Copy link
Member

@andersio andersio commented Aug 10, 2020

When Floodgate.withValue owns the recursive lock, events enqueued in parallel might be left unprocessed until another enqueue attempt.

This is because Floodgate.process(_:for:) assumes that, when the call is reentrant, the lock owner is already running an event drain loop. This holds true when Floodgate.process(_:for:) recursively calls itself. But this doesn't hold true when Floodgate.process(_:for:) is the indirect caller of Floodgate.process(_:for:).

This PR refactored the code path, and makes sure that all reducerLock holder fulfills their obligation to drain the event queue after having held the lock.

Included a test case that fails on develop and 2.0.0-beta1.

@andersio andersio added the bug Something isn't working label Aug 10, 2020
@andersio andersio self-assigned this Aug 10, 2020
@sergdort sergdort merged commit 4eb3c52 into develop Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants