Minor retry tuning to improve behavior under failing conditions.
This branch fixes a couple of bugs and misdesigns that caused Arti to retry a few things too aggressively, or too many times. It fixes some of the "low hanging fruit" from #329 (closed).
Merge request reports
Activity
assigned to @nickm
requested review from @Diziet
292 // This ensures that we always wait between attempts, but not after 293 // the final attempt. 294 if let Some(delay) = delay.take() { 295 debug!("Waiting {:?} for next download attempt...", delay); 296 futures::select_biased! { 297 _ = reset_timeout_future => { 298 info!("Download attempt timed out completely; resetting download state."); 299 state = state.reset()?; 300 continue 'next_state; 301 } 302 _ = FutureExt::fuse(runtime.sleep(delay)) => {} 303 }; 304 } 305 // Make sure that `delay` is set for the next iteration of the loop. 306 delay = Some(retry.next_delay(&mut rand::thread_rng())); 307 - Comment on lines +294 to +307
This approach leaves
delay
in a wrong state in the body of theif let
. In the (admittedly fairly unliikely) case that extra code appears there, it might leavedelay
set toNone
andcontinue
or something. How aboutif let Some(delay) = mem::replace(&mut delay, ... next_delay ...)
, or maybe replacing delay withlet mut skip_first_delay = iter::once(())
and then you can doif skip_first_delay.next().is_none() { let delay = ...
.
enabled an automatic merge when the pipeline for c5e5fc15 succeeds
mentioned in commit a461ddc9