Skip to content

Commit

Permalink
Revert "removed retry delay"
Browse files Browse the repository at this point in the history
This reverts commit 37ed2a0.
  • Loading branch information
1zun4 committed Jan 7, 2024
1 parent 37ed2a0 commit 19792ae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion azalea/src/swarm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,13 +597,18 @@ impl Swarm {
account: &Account,
state: S,
) -> Client {
let mut disconnects = 0;
loop {
let proxy = self.proxies.choose(&mut thread_rng()).map(|p| p.clone());

Check warning on line 602 in azalea/src/swarm/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

you are using an explicit closure for cloning elements

warning: you are using an explicit closure for cloning elements --> azalea/src/swarm/mod.rs:602:25 | 602 | let proxy = self.proxies.choose(&mut thread_rng()).map(|p| p.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `self.proxies.choose(&mut thread_rng()).cloned()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone = note: `#[warn(clippy::map_clone)]` on by default
match self.add(account, proxy, state.clone()).await {
Ok(bot) => return bot,
Err(e) => {
disconnects += 1;
let delay = (Duration::from_secs(5) * 2u32.pow(disconnects.min(16)))
.min(Duration::from_secs(15));
let username = account.username.clone();
error!("Error joining as {username}: {e}. Retrying...");
error!("Error joining as {username}: {e}. Waiting {delay:?} and trying again.");
tokio::time::sleep(delay).await;
}
}
}
Expand Down

0 comments on commit 19792ae

Please sign in to comment.