Skip to content

Commit

Permalink
Improved retry loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ElFantasma committed Mar 13, 2024
1 parent 14259dd commit 4685bb1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions node/tools/src/k8s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,12 @@ where
Fut: std::future::Future<Output = anyhow::Result<T>>,
{
let mut interval = time::interval(delay);
let mut count = 0;
loop {
for count in 0.. {
interval.tick().await;
count += 1;
let result = f().await;
if result.is_ok() || count > retries {
return result;
}
}
unreachable!("Loop sould always return")
}

0 comments on commit 4685bb1

Please sign in to comment.