async fn wait_until_healthy<T>(&self, timeout: T) -> Result<(), Error>
    where
        T: Into<Duration> + Send,
    {
        let timeout = timeout.into();
        let poll_interval = Duration::from_millis(200);
        let mut attempts_remaining = timeout.as_millis() / poll_interval.as_millis();

        while self.health().await.is_err() {
            if attempts_remaining == 0 {
                return Err(Error::timeout(timeout));
            }

            attempts_remaining -= 1;
            time::sleep(poll_interval).await;
        }

        Ok(())
    }
/// Poll the `/health` endpoint until it returns a successful result or
/// the given `timeout` has elapsed.
Poll the `/health` endpoint until it returns a successful result or
the given `timeout` has elapsed.
Poll the ` / health ` endpoint until it returns a successful result or the given ` timeout ` has elapsed .
async fn wait_until_healthy<T>(&self, timeout: T) -> Result<(), Error>
    where
        T: Into<Duration> + Send,
    {
        let timeout = timeout.into();
        let poll_interval = Duration::from_millis(200);
        let mut attempts_remaining = timeout.as_millis() / poll_interval.as_millis();
        while self.health().await.is_err() {
            if attempts_remaining == 0 {
                return Err(Error::timeout(timeout));
            }
            attempts_remaining -= 1;
            time::sleep(poll_interval).await;
        }
        Ok(())
    }
async fn wait_until_healthy < T > ( & self , timeout : T ) -> Result < ( ) , Error > where T : Into < Duration > + Send , { let timeout = timeout . into ( ) ; let poll_interval = Duration :: from_millis ( 200 ) ; let mut attempts_remaining = timeout . as_millis ( ) / poll_interval . as_millis ( ) ; while self . health ( ) . await . is_err ( ) { if attempts_remaining == 0 { return Err ( Error :: timeout ( timeout ) ) ; } attempts_remaining -= 1 ; time :: sleep ( poll_interval ) . await ; } Ok ( ( ) ) }
Poll the `/health` endpoint until it returns a successful result or
the given `timeout` has elapsed.
Poll the ` / health ` endpoint until it returns a successful result or the given ` timeout ` has elapsed .
&self
timeout
T