Move RetryDelay into tor-basic-utils
This is a prerequisite for some work on #406 (closed) and #407 (closed).
Merge request reports
Activity
assigned to @nickm
requested review from @Diziet
101 101 pub fn next_delay<R: Rng>(&mut self, rng: &mut R) -> Duration { 102 102 Duration::from_millis(u64::from(self.next_delay_msec(rng))) 103 103 } 104 105 /// Return the most recent delay returned, if there was one. 106 pub fn last_delay(&self) -> Option<Duration> { Not possible; after the move, these functions need to be accessed from
tor-dirmgr
's tests, and tests don't build other crates withcfg(test)
.How strongly do you feel that these functions shouldn't be part of the main API? I could put them behind a feature if you really think it's necessary.
Hmm. It seems like a detail I wouldn't want to expose; in particular, it's a part of the implementation of the precise algorith, and other kinds of stochastic retry algorithms might have different parameters.
Perhaps this means that the tests are in the wrong place.
Would it be too much trouble to put them behind an unstable-api feature gate? tor-basic-utils doesn't have one of those but it seems plausible that it should have one.
mentioned in commit 644f962c