From 175eacfac37cbe05911fa2d19dee7e7fa38a5c2e Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 1 Dec 2023 22:51:27 -0600 Subject: rename add_with_exponential_backoff to add_and_retry_forever --- azalea/examples/testbot.rs | 4 +--- azalea/src/swarm/mod.rs | 12 +++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/azalea/examples/testbot.rs b/azalea/examples/testbot.rs index 74ecfd8a..aa47d5a2 100644 --- a/azalea/examples/testbot.rs +++ b/azalea/examples/testbot.rs @@ -376,9 +376,7 @@ async fn swarm_handle( SwarmEvent::Disconnect(account) => { println!("bot got kicked! {}", account.username); tokio::time::sleep(Duration::from_secs(5)).await; - swarm - .add_with_exponential_backoff(account, State::default()) - .await; + swarm.add_and_retry_forever(account, State::default()).await; } SwarmEvent::Chat(m) => { println!("swarm chat message: {}", m.message().to_ansi()); diff --git a/azalea/src/swarm/mod.rs b/azalea/src/swarm/mod.rs index 0a263f39..e8b47de6 100644 --- a/azalea/src/swarm/mod.rs +++ b/azalea/src/swarm/mod.rs @@ -349,9 +349,7 @@ where if let Some(join_delay) = join_delay { // if there's a join delay, then join one by one for (account, state) in accounts.iter().zip(states) { - swarm_clone - .add_with_exponential_backoff(account, state) - .await; + swarm_clone.add_and_retry_forever(account, state).await; tokio::time::sleep(join_delay).await; } } else { @@ -364,7 +362,7 @@ where .map(move |(account, state)| async { swarm_borrow .clone() - .add_with_exponential_backoff(account, state) + .add_and_retry_forever(account, state) .await; }), ) @@ -575,9 +573,9 @@ impl Swarm { /// Add a new account to the swarm, retrying if it couldn't join. This will /// run forever until the bot joins or the task is aborted. /// - /// Exponential backoff means if it fails joining it will initially wait 10 - /// seconds, then 20, then 40, up to 2 minutes. - pub async fn add_with_exponential_backoff( + /// This does exponential backoff (though very limited), starting at 5 + /// seconds and doubling up to 15 seconds. + pub async fn add_and_retry_forever( &mut self, account: &Account, state: S, -- cgit v1.2.3