From ebdc910a575ac39be8dc446615cb7b57d23706e5 Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Sun, 24 Dec 2023 09:19:57 -0600 Subject: [PATCH] linear backoff --- server/src/turtle.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/turtle.rs b/server/src/turtle.rs index 5e465ce..2ff50a8 100644 --- a/server/src/turtle.rs +++ b/server/src/turtle.rs @@ -212,11 +212,16 @@ impl TurtleCommander { } pub async fn dock(&self) -> usize { + let mut wait = 1; loop { let res = Depots::dock(&self.depots, self.to_owned()).await; if let Some(fuel) = res { return fuel; } + // this is a poor way to do this, but I feel like select! ing on 30 different things + // would be harder + tokio::time::sleep(Duration::from_millis(wait)).await; + wait += 1; } }