-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use oneshot channel in Client::send_request()
This changes the `pending_requests` map to use a oneshot async channel to simplify the code and better capitalize on the async runtime. The previous implementation used a `loop` to poll the `pending_requests` hashmap and explicitly yield execution back to the executor by calling `tokio::task::yield_now()` if the client's response hasn't been received yet by the server. This should hopefully be a bit more efficient, given that `futures::channel::oneshot::channel()` is presumably using the underlying runtime's task scheduler more efficiently. This assumption hasn't been tested with dedicated benchmarks, however, but the code is much easier to reason about, though. Original suggestion here: #134 (comment)
- Loading branch information
1 parent
2843da6
commit f56bb32
Showing
1 changed file
with
23 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters