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

Race condition #4

Open
KonstantinSchubert opened this issue Aug 6, 2017 · 1 comment
Open

Race condition #4

KonstantinSchubert opened this issue Aug 6, 2017 · 1 comment

Comments

@KonstantinSchubert
Copy link

I like your code, and I am building something on top of it.
But I think that there is a race condition.
When two ajax requests are happening almost simultaneously, thy might both trigger the Javascript interface first and then bothtrigger shouldInterceptRequest.
In that case, the member variable holding the post content will be wrong.

I have fixed by adding an ID to the URL and using a map to store the post contents. I'll post as soon as I've cleaned up the code.

@KonstantinSchubert
Copy link
Author

Here is what I have built:

https://github.com/KonstantinSchubert/request_data_webviewclient

I append an ID to the url and to the post content to mark the request and match the two back togheter. That solves the race condition I mentioned.

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

No branches or pull requests

1 participant