Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the user-provided SleepFuture for interval checks in background-processor #1962

Merged
merged 3 commits into from
Jan 17, 2023

Conversation

TheBlueMatt
Copy link
Collaborator

background-processor does a number of jobs on various timers.
Currently, those are all done by checking the timers every 100ms
by interrogating std::time::Instant. This is fine for the
threaded version, but we'd like more flexibility in the futures-
based background-processor.

Here we swap the std::time::Instant interrogation for a lambda
which we will switch out to the user-provided sleeper for the async futures version.

Fixes #1864.

`background-processor` does a number of jobs on various timers.
Currently, those are all done by checking the timers every 100ms
by interrogating `std::time::Instant`. This is fine for the
threaded version, but we'd like more flexibility in the `futures`-
based `background-processor`.

Here we swap the `std::time::Instant` interrogation for a lambda
which we will switch out to the user-provided sleeper in the next
commit.
`background-processor` does a number of jobs on various timers.
Instead of doing those by interrogating `std::time::Instant`, this
change swaps to using the existing user-provided sleep future.

Fixes lightningdevkit#1864.
@TheBlueMatt TheBlueMatt added this to the 0.0.114 milestone Jan 17, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2023

Codecov Report

Base: 90.72% // Head: 90.75% // Increases project coverage by +0.03% 🎉

Coverage data is based on head (1540f5e) compared to base (ce6bcf6).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1962      +/-   ##
==========================================
+ Coverage   90.72%   90.75%   +0.03%     
==========================================
  Files          97       97              
  Lines       50579    51341     +762     
  Branches    50579    51341     +762     
==========================================
+ Hits        45888    46595     +707     
- Misses       4691     4746      +55     
Impacted Files Coverage Δ
lightning-background-processor/src/lib.rs 95.46% <100.00%> (+0.01%) ⬆️
lightning/src/chain/onchaintx.rs 95.18% <0.00%> (-0.21%) ⬇️
lightning/src/chain/channelmonitor.rs 91.03% <0.00%> (-0.05%) ⬇️
lightning/src/ln/functional_tests.rs 97.01% <0.00%> (-0.02%) ⬇️
lightning/src/ln/priv_short_conf_tests.rs 96.53% <0.00%> (-0.01%) ⬇️
lightning/src/ln/channelmanager.rs 87.13% <0.00%> (+<0.01%) ⬆️
lightning/src/ln/peer_handler.rs 56.67% <0.00%> (+0.85%) ⬆️
lightning/src/ln/reload_tests.rs 96.48% <0.00%> (+0.89%) ⬆️
lightning/src/ln/shutdown_tests.rs 97.67% <0.00%> (+1.15%) ⬆️
lightning/src/ln/functional_test_utils.rs 94.24% <0.00%> (+2.74%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@wpaulino
Copy link
Contributor

LGTM after squash.

This makes `background-processor` build without `std` at all. This
isn't particularly useful in the general no-std case as
`background-processor` is only useful with the `futures` feature,
and async will generally need `std` in some way or another. Still,
it ensures we don't end up reintroducing a dependency on the
current time, which breaks `wasm` use-cases.
@TheBlueMatt TheBlueMatt merged commit c86950d into lightningdevkit:main Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BackgroundProcessor is not wasm-web compatible
5 participants