Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch updates Tower to depend on Tokio v1.0. In particular, the
following changes were necessary:
tokio::sync::Semaphore
now has aclose
operation, so permitacquisition is fallible. Our uses of the semaphore are updated to
handle this. Also, this allows removing the janky homemade
implementation of closing semaphores by adding a big pile of
permits!
tokio::sync
's channels are no longerStream
s. This necessitated afew changes:
poll_next
calls withpoll_recv
mpsc::Receiver
as aStream
to adda wrapper type that makes it a
Stream
CallAll
's examples (I changed it to just use afutures::channel
MPSC)tokio::time::Sleep
is no longerUnpin
. Therefore, the rate-limitService
needs toBox::pin
it. To avoid the overhead ofallocating/deallocating
Box
es every time the rate limit isexhausted, I moved the
Sleep
out of theState
enum and onto theService
struct, and changed the code toreset
it every time theservice is rate-limited. This way, we only allocate the box once when
the service is created.
There should be no actual changes in functionality.