fn wait_for_propagation(
    rt: &mut tokio::runtime::Runtime,
    request: &reqwest::RequestBuilder,
    received_message_count: usize,
    receiver: &mut tokio::sync::mpsc::Receiver<tungstenite::Message>,
) {
    let delay_ms = 100;
    let timeout_ms = 40000;
    let tries_until_timeout = timeout_ms / delay_ms;
    rt.block_on(async {
        for i in 0..tries_until_timeout {
            let response = request.try_clone().unwrap().send().await.unwrap();
            if response.status().is_success() {
                break;
            }
            if i == tries_until_timeout - 1 {
                panic!("Timeout: Responses keep on failing: {:?}", response);
            }
            tokio::time::sleep(std::time::Duration::from_millis(delay_ms)).await;
        }
        for _ in 0..received_message_count {
            // TODO check if received data is correct
            receiver.recv().await.unwrap();
        }
    });
}
/// Route propagation has a slow startup sometimes.
/// Loops until route propagation is on.
Route propagation has a slow startup sometimes.
Loops until route propagation is on.
Route propagation has a slow startup sometimes . Loops until route propagation is on .
fn wait_for_propagation(
    rt: &mut tokio::runtime::Runtime,
    request: &reqwest::RequestBuilder,
    received_message_count: usize,
    receiver: &mut tokio::sync::mpsc::Receiver<tungstenite::Message>,
) {
    let delay_ms = 100;
    let timeout_ms = 40000;
    let tries_until_timeout = timeout_ms / delay_ms;
    rt.block_on(async {
        for i in 0..tries_until_timeout {
            let response = request.try_clone().unwrap().send().await.unwrap();
            if response.status().is_success() {
                break;
            }
            if i == tries_until_timeout - 1 {
                panic!("Timeout: Responses keep on failing: {:?}", response);
            }
            tokio::time::sleep(std::time::Duration::from_millis(delay_ms)).await;
        }
        for _ in 0..received_message_count {
            // TODO check if received data is correct
            receiver.recv().await.unwrap();
        }
    });
}
fn wait_for_propagation ( rt : & mut tokio :: runtime :: Runtime , request : & reqwest :: RequestBuilder , received_message_count : usize , receiver : & mut tokio :: sync :: mpsc :: Receiver < tungstenite :: Message > , ) { let delay_ms = 100 ; let timeout_ms = 40000 ; let tries_until_timeout = timeout_ms / delay_ms ; rt . block_on ( async { for i in 0 .. tries_until_timeout { let response = request . try_clone ( ) . unwrap ( ) . send ( ) . await . unwrap ( ) ; if response . status ( ) . is_success ( ) { break ; } if i == tries_until_timeout - 1 { panic ! ( " " response ) ; } tokio :: time :: sleep ( std :: time :: Duration :: from_millis ( delay_ms ) ) . await ; } for _ in 0 .. received_message_count { // TODO check if received data is correct receiver . recv ( ) . await . unwrap ( ) ; } } ) ; }
Route propagation has a slow startup sometimes.
Route propagation has a slow startup sometimes .
rt
&mut tokio::runtime::Runtime
request
&reqwest::RequestBuilder
received_message_count
usize
receiver
&mut tokio::sync::mpsc::Receiver<tungstenite::Message>
rt
&mut tokio::runtime::Runtime
request
&reqwest::RequestBuilder
received_message_count
usize
receiver
&mut tokio::sync::mpsc::Receiver<tungstenite::Message>