mockhttp icon indicating copy to clipboard operation
mockhttp copied to clipboard

requestExpectations queue not thread safe

Open ddizik opened this issue 4 years ago • 1 comments

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

ddizik avatar Jun 21 '21 18:06 ddizik

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 avatar Jul 12 '22 11:07 richardszalay

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).

richardszalay avatar Sep 02 '22 23:09 richardszalay