Skip to content

Call peer_manager.process_events() in BackgroundProcessor #864

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

Conversation

valentinewallace
Copy link
Contributor

@valentinewallace valentinewallace commented Apr 2, 2021

It makes sense for RL to handle this on behalf of the user if possible, and BackgroundProcessor seems to be a sane place to put it.

@codecov
Copy link

codecov bot commented Apr 2, 2021

Codecov Report

Merging #864 (0c34529) into main (df732f4) will increase coverage by 0.03%.
The diff coverage is 76.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #864      +/-   ##
==========================================
+ Coverage   90.59%   90.62%   +0.03%     
==========================================
  Files          51       51              
  Lines       27195    27200       +5     
==========================================
+ Hits        24638    24651      +13     
+ Misses       2557     2549       -8     
Impacted Files Coverage Δ
background-processor/src/lib.rs 96.00% <76.47%> (-4.00%) ⬇️
lightning/src/ln/functional_tests.rs 97.07% <0.00%> (+0.19%) ⬆️
lightning/src/util/test_utils.rs 83.23% <0.00%> (+0.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df732f4...0c34529. Read the comment docs.

{
let stop_thread = Arc::new(AtomicBool::new(false));
let stop_thread_clone = stop_thread.clone();
let handle = thread::spawn(move || -> Result<(), std::io::Error> {
let mut current_time = Instant::now();
loop {
let updates_available = manager.await_persistable_update_timeout(Duration::from_millis(100));
peer_manager.process_events();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, unrelated to this PR, but we really need to fix support for knowing we need to persist if something happened while we weren't awaiting. Probably some unique id that just gets incremented every time we would wake up any waiters and then get that as a part of the write process. Then we can always check that the ID is the latest.

@TheBlueMatt TheBlueMatt merged commit de6dded into lightningdevkit:main Apr 5, 2021
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.

3 participants