Skip to content

Commit 28020fc

Browse files
committed
sleep on connection retry loops of integration_tests_sv2::{MockDownstream,Sniffer,SnifferSV1}
1 parent e2b19c1 commit 28020fc

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

integration-tests/lib/mock_roles.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ impl MockDownstream {
3030
match TcpStream::connect(upstream_address).await {
3131
Ok(stream) => break stream,
3232
Err(_) => {
33-
println!("MockDownstream: unable to connect to upstream, retrying");
33+
tracing::warn!(
34+
"MockDownstream: unable to connect to upstream, retrying after 1 second"
35+
);
36+
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
3437
}
3538
}
3639
})

integration-tests/lib/sniffer.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,12 @@ impl<'a> Sniffer<'a> {
9595
match TcpStream::connect(upstream_address).await {
9696
Ok(stream) => break stream,
9797
Err(_) => {
98-
println!(
99-
"Sniffer {}: unable to connect to upstream {}, retrying",
100-
identifier, upstream_address
98+
tracing::warn!(
99+
"Sniffer {}: unable to connect to upstream {}, retrying after 1 second",
100+
identifier,
101+
upstream_address
101102
);
103+
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
102104
}
103105
}
104106
})

integration-tests/lib/sv1_sniffer.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ impl SnifferSV1 {
5959
match TcpStream::connect(upstream_address).await {
6060
Ok(s) => break s,
6161
Err(_) => {
62+
tracing::warn!(
63+
"SnifferSV1: unable to connect to upstream, retrying after 1 second"
64+
);
65+
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
6266
continue;
6367
}
6468
}

0 commit comments

Comments
 (0)