Add a parallel async event handler to OnionMessenger and pass it directly to BackgroundProcessor
This adds an OnionMessenger::process_pending_events_async
mirroring the same in ChannelManager. However, unlike the one in
ChannelManager, this processes the events in parallel by spawning
all futures and using the new MultiFuturePoller.
Because OnionMessenger just generates a stream of messages to
store/fetch, we first process all the events to store new messages,
await them, then process all the events to fetch stored messages,
ensuring reordering shouldn't result in lost messages (unless we
race with a peer disconnection, which could happen anyway).
Codecov Report
Attention: Patch coverage is 78.07018% with 25 lines in your changes missing coverage. Please review.
Project coverage is 92.08%. Comparing base (
0ffa4b3) to head (fadb268). Report is 76 commits behind head on main.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## main #3060 +/- ##
==========================================
+ Coverage 89.83% 92.08% +2.25%
==========================================
Files 116 118 +2
Lines 96472 113057 +16585
Branches 96472 113057 +16585
==========================================
+ Hits 86663 104113 +17450
+ Misses 7244 6726 -518
+ Partials 2565 2218 -347
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Looks like 1.63 builds are sad
Addressed @jkczyz's point and squashed:
$ git diff-tree -U1 fadb26875 21aebd2d7
diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs
index 6b7cd5b05..a17f514a5 100644
--- a/lightning-background-processor/src/lib.rs
+++ b/lightning-background-processor/src/lib.rs
@@ -57,5 +57,2 @@ use std::time::Instant;
-#[cfg(not(feature = "std"))]
-use alloc::boxed::Box;
-
/// `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
@@ -696,3 +693,3 @@ where
let fetch_time = &fetch_time;
- Box::pin(async move { // We should be able to drop the Box once our MSRV is 1.68
+ async move { // We should be able to drop the Box once our MSRV is 1.68
if let Some(network_graph) = network_graph {
@@ -711,3 +708,3 @@ where
event_handler(event).await;
- })
+ }
};
LGTM after the comment about Box is removed.
:facepalm:
$ git diff-tree -U1 21aebd2d eedceeb3
diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs
index a17f514a5..a5d56c459 100644
--- a/lightning-background-processor/src/lib.rs
+++ b/lightning-background-processor/src/lib.rs
@@ -693,3 +693,3 @@ where
let fetch_time = &fetch_time;
- async move { // We should be able to drop the Box once our MSRV is 1.68
+ async move {
if let Some(network_graph) = network_graph {
Unfortunately tests are still failing due to !Unpin issues.
Doh! That's why the Box was there...
Reverted to include the Box again.
lol ffs merged without noticing there were still fixup commits...oh well, they were just doc fixes so not really a big deal.