rustasync / runtime

Empowering everyone to build asynchronous software
https://docs.rs/runtime
Apache License 2.0
862 stars 28 forks source link

Fix blocking in guessing example. #35

Closed wfxr closed 5 years ago

wfxr commented 5 years ago

Description

Remove await? inner the while loop which block the server from serving the next client.

Types of changes

yoshuawuyts commented 5 years ago

Thanks for this patch! -- your thinking here is sound, and we've been thinking about this too for a while! We've come up with a slightly more structural fix by using try_for_each_concurrent (https://github.com/rustasync/runtime/pull/24), which can also join all errors.

In itself that's not a great API, so we've started work on #25 to make parallel loop iteration easy to do. Do you feel this would be helpful for you?

wfxr commented 5 years ago

@yoshuawuyts OK. I See. Thanks for your explanation.

yoshuawuyts commented 5 years ago

@wfxr glad it was helpful; going to close this PR out in favor of #24 then (: