Skip to content

Commit ca367f5

Browse files
committed
Ensure background-processor exits after any sleep future says to
If the user's sleep future passed to an async background processor only returns true for exiting once and then reverts back to false, we should exit anyway when we get a chance to. We do to this here by always ensuring we check the exit flag even when only polling sleep futures with no intent to (yet) exit. This is utilized in the tests added in the coming commit(s).
1 parent 8676c5a commit ca367f5

File tree

1 file changed

+4
-1
lines changed
  • lightning-background-processor/src

1 file changed

+4
-1
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,10 @@ where
554554
|fut: &mut SleepFuture, _| {
555555
let mut waker = dummy_waker();
556556
let mut ctx = task::Context::from_waker(&mut waker);
557-
core::pin::Pin::new(fut).poll(&mut ctx).is_ready()
557+
match core::pin::Pin::new(fut).poll(&mut ctx) {
558+
task::Poll::Ready(exit) => { should_break = exit; true },
559+
task::Poll::Pending => false,
560+
}
558561
}, mobile_interruptable_platform)
559562
}
560563

0 commit comments

Comments
 (0)