-
Notifications
You must be signed in to change notification settings - Fork 404
Correct peer_handler::test_process_events_multithreaded
#3254
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
Correct peer_handler::test_process_events_multithreaded
#3254
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3254 +/- ##
==========================================
+ Coverage 89.65% 90.23% +0.58%
==========================================
Files 125 125
Lines 102546 105713 +3167
Branches 102546 105713 +3167
==========================================
+ Hits 91936 95395 +3459
+ Misses 7904 7727 -177
+ Partials 2706 2591 -115 ☔ View full report in Codecov by Sentry. |
36b4b7e
to
9f3ca3d
Compare
while start_time.elapsed() < Duration::from_millis(100) { | ||
let val = cfg[0].chan_handler.message_fetch_counter.load(Ordering::Acquire); | ||
assert!(val <= 2); | ||
std::thread::yield_now(); // Winblowz seemingly doesn't ever interrupt threads?! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, none of the threads completely busy-loop now, they all sleep which should yield++.
This test was added some time ago in 0c034e9, but never made any sense. `PeerManager::process_events` will go around its loop as many times is required to ensure we've always processed all events which were pending prior to a `process_events` call, so having a test that checks that we never go around more than twice is obviously broken. And, indeed, in CI this tests fails with some regularity. Instead, the test here is changed to ensure that we detectably go around the loop again at least once. Fixes lightningdevkit#2385
9f3ca3d
to
e34519b
Compare
Squash-pushed with only the spelling change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Merging with 1 ack since it's just a test change
b2cdc2c
into
lightningdevkit:main
This test was added some time ago in
0c034e9, but never made any sense.
PeerManager::process_events
will go around its loop as many times is required to ensure we've always processed all events which were pending prior to aprocess_events
call, so having a test that checks that we never go around more than twice is obviously broken.And, indeed, in CI this tests fails with some regularity.
Instead, the test here is changed to ensure that we detectably go around the loop again at least once.
Fixes #2385