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

Prevent race condition when triggering multiple requests #84

Open
zxqx opened this issue Oct 8, 2019 · 0 comments
Open

Prevent race condition when triggering multiple requests #84

zxqx opened this issue Oct 8, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@zxqx
Copy link
Member

zxqx commented Oct 8, 2019

Currently if a consumer triggers multiple requests, a race condition can occur causing unexpected results.

Example:

  • Request 1 triggered on initial render
  • Request 2 is triggered as an effect of config changing
  • Request 2 resolves and updates state
  • Request 1 resolves and updates state

In this scenario, the final state after both requests resolve is the response of Request 1, while the consumer expects it to be the response of Request 2.

To ensure this can't happen, we should consider cancelling the current inflight request when a new one is triggered.

@zxqx zxqx added the bug Something isn't working label Oct 8, 2019
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

No branches or pull requests

2 participants