Function poll_until

Source
pub async fn poll_until<F, Fut>(
    check: F,
    max_wait: Duration,
    poll_interval: Duration,
    operation_name: &str,
) -> Result<bool>
where F: Fn() -> Fut, Fut: Future<Output = Result<bool>>,
Expand description

Polls until a condition is met or timeout is reached.

This helper provides a reusable abstraction for waiting on async conditions with configurable timeout and polling interval.

§Arguments

  • check - Closure that returns Ok(true) when condition is met, Ok(false) to continue polling
  • max_wait - Maximum time to wait before giving up
  • poll_interval - Time to sleep between polls
  • operation_name - Name of the operation for logging

§Returns

  • Ok(true) - Condition was met within timeout
  • Ok(false) - Timeout reached without condition being met (errors are logged and polling continues)