Skip to content

Commit

Permalink
ready-cache: restore assert for dropped cancel tx
Browse files Browse the repository at this point in the history
When ready-cache was upgraded from futures 0.1 to `std::future` in
e2f1a49, this `expect` was removed, and
the code instead silently ignores the error. That's probably not what we
want, so this patch restores that assertion.
  • Loading branch information
jonhoo committed Feb 20, 2020
1 parent 1a67100 commit be156e7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tower-ready-cache/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ where

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let mut fut = self.cancel.as_mut().expect("polled after complete");
if let Poll::Ready(Ok(_)) = Pin::new(&mut fut).poll(cx) {
if let Poll::Ready(r) = Pin::new(&mut fut).poll(cx) {
assert!(r.is_ok(), "cancel sender lost");
let key = self.key.take().expect("polled after complete");
return Err(PendingError::Canceled(key)).into();
}
Expand Down

0 comments on commit be156e7

Please sign in to comment.