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

requestExpectations queue not thread safe #88

Closed
ddizik opened this issue Jun 21, 2021 · 2 comments · May be fixed by #145
Closed

requestExpectations queue not thread safe #88

ddizik opened this issue Jun 21, 2021 · 2 comments · May be fixed by #145

Comments

@ddizik
Copy link

ddizik commented Jun 21, 2021

Hello Richard Szalay,

first of all, thank you very much for this very helpfull library. One thing I have found on using it - if you use expectations with multithreaded application, then the queue requestExpectations in MockHttpMessageHandler.cs (line 16) sometimes becomes negative valued, because it is not thread safe. Maybe its a good idea to use your lock object to lock the queue or to use the ConcurrentQueue.

Thank you very much

@richardszalay
Copy link
Owner

Great idea @ddizik. I might look at including this the next time I update the library. Alternatively, if you're happy to submit a PR - feel free!

@richardszalay
Copy link
Owner

I'm going to close this issue as it's not something I currently require. I will happy accept a PR from the community, though, if it is causing anyone problems (as long as it comes with tests and doesn't cause compat issues).

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 a pull request may close this issue.

2 participants