-
Notifications
You must be signed in to change notification settings - Fork 11
Make ads::client::Client
sync
#39
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
base: master
Are you sure you want to change the base?
Conversation
Hi, thanks for the PR! The problem is that when communicate can be called concurrently, replies are not guaranteed to end up where they need to go - if two threads start a request at the same time, the reader thread will just send both replies to the channel, and each calling thread will get one, but they might be the wrong ones. It's certainly possible to make it work, but so far I haven't thought about what the minimal/best change to the architecture would look like to achieve that. |
I wrapped all of the client network IO in a mutexed block. I can see this getting more efficient if you wanted to adopt a coroutine-oriented api with primitives from |
@birkenfeld I ended up refactoring the background worker logic a bit so that the client can dispatch requests concurrently and receive their responses asynchronously |
2608f1a
to
060d3c2
Compare
Hey @birkenfeld just a friendly ping :) |
Thanks! This isn't forgotten, I just need a quiet time for review... Fortunately some leave is coming up during which I might have time for that. |
No problem, like I said before, feel free to suggest/make changes! |
I also had a productive conversation with bhf support about routing in general, and now I'm fairly certain that the |
This is the minimum diff required to make
ads::client::Client
sync. I considered making a specialError
variant specific to locks, but I'm pretty sure that there's no way application code to induce a poisoned lock, and any poisons that come from standard library panics should definitely result in an aborted application.Feel free to modify.