Skip to content

Commit 4c7b302

Browse files
committed
f Limit maximum tries
1 parent 387ee6d commit 4c7b302

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lightning-transaction-sync/tests/integration_tests.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,16 @@ where
7878
F: FnMut() -> Option<T>,
7979
{
8080
let mut delay = Duration::from_millis(64);
81+
let mut tries = 0;
8182
loop {
8283
match poll() {
8384
Some(data) => break data,
84-
None if delay.as_millis() < 512 => delay = delay.mul_f32(2.0),
85-
None => {}
85+
None if delay.as_millis() < 512 => {
86+
delay = delay.mul_f32(2.0);
87+
tries += 1;
88+
}
89+
None if tries == 10 => panic!("Exceeded our maximum wait time."),
90+
None => tries += 1,
8691
}
8792

8893
std::thread::sleep(delay);

0 commit comments

Comments
 (0)