diff --git a/cdn-client/src/retry.rs b/cdn-client/src/retry.rs index f1b6ae7..4c77889 100644 --- a/cdn-client/src/retry.rs +++ b/cdn-client/src/retry.rs @@ -164,6 +164,7 @@ impl Retry { let inner = self.inner.clone(); spawn(async move { let mut connection = inner.connection.write().await; + let mut retry_count = 0; // Forever, loop { @@ -176,8 +177,10 @@ impl Retry { } Err(err) => { // We failed to reconnect + retry_count += 1; // Sleep for 2 seconds and then try again - error!("failed to connect: {err}"); + error!("failed to connect: {err}. attempts: {retry_count}"); + tokio::task::yield_now().await; sleep(Duration::from_secs(2)).await; } }