Skip to content

Commit

Permalink
fix: consume all payload variants (#12520)
Browse files Browse the repository at this point in the history
Co-authored-by: Arsenii Kulikov <[email protected]>
  • Loading branch information
mattsse and klkvr authored Nov 13, 2024
1 parent 413d651 commit 0d850e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/payload/basic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,9 @@ where
if let Some(fut) = Pin::new(&mut this.maybe_better).as_pin_mut() {
if let Poll::Ready(res) = fut.poll(cx) {
this.maybe_better = None;
if let Ok(BuildOutcome::Better { payload, .. }) = res {
if let Ok(Some(payload)) = res.map(|out| out.into_payload())
.inspect_err(|err| warn!(target: "payload_builder", %err, "failed to resolve pending payload"))
{
debug!(target: "payload_builder", "resolving better payload");
return Poll::Ready(Ok(payload))
}
Expand Down Expand Up @@ -767,7 +769,7 @@ impl<Payload> BuildOutcome<Payload> {
/// Consumes the type and returns the payload if the outcome is `Better`.
pub fn into_payload(self) -> Option<Payload> {
match self {
Self::Better { payload, .. } => Some(payload),
Self::Better { payload, .. } | Self::Freeze(payload) => Some(payload),
_ => None,
}
}
Expand Down

0 comments on commit 0d850e7

Please sign in to comment.