Improve retry logic and update unmaintained dependencies for Rust lint CI#2673
Improve retry logic and update unmaintained dependencies for Rust lint CI#2673barshaul merged 8 commits intovalkey-io:release-1.2from
Conversation
Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
…ed "tokio-retry" Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
Signed-off-by: barshaul <barshaul@amazon.com>
| ExponentialBackoff::from_millis(self.exponent_base as u64) | ||
| .factor(self.factor as u64) | ||
| .map(jitter) | ||
| .map(jitter_range(0.8, 1.2)) |
There was a problem hiding this comment.
How did you come up with these numbers?
There was a problem hiding this comment.
Till now, the jitter range was (0,1). This change reduces the range to 20% above and below the interval, which is sufficient to spread requests across different time slots from various hosts, while maintaining increasing intervals
| ) | ||
| .map(jitter_range(0.8, 1.2)) | ||
| .take(DEFAULT_NUMBER_OF_REFRESH_SLOTS_RETRIES); | ||
| let retries_counter = AtomicUsize::new(0); |
There was a problem hiding this comment.
Why do we need to use the counter and not the built in limiter? Is there a reason we need to use the number down the tree?
If it can be changed and managed in one place it will reduce complexity.
There was a problem hiding this comment.
We use the retry number internally to calculate topology to know if we're at the last try - and if we are, we have less restrictions on choosing the topology view
There was a problem hiding this comment.
Note the we don't use it as a limit anymore, only for the sake of choosing the topology.
There was a problem hiding this comment.
I see I tried to see if there's a way to call something different on last try. It appears that the only callback is notify, which can be used, but it's not the reason it exists, so probably not a good idea.
In general, I would prefer the called function to have one logic, and the caller to call functions base on needs, so we keep functions shorter and more readable. That's why I want to avoid the counter logic.
But couldn't find a replacement currently.
…t CI (valkey-io#2673) Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
…t CI (valkey-io#2673) Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
…t CI (valkey-io#2673) Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
…t CI (valkey-io#2673) Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
PR Description:
This PR enhances the retry strategy and addresses dependency maintenance issues in the Rust lint CI:
Replaced Unmaintained Crates: Removed the
backoff,tokio-retry,futures-timeandDerivativecrates due to limited functionality and lack of maintenance. Previously, the project used bothbackoff(unmaintained) andtokio-retry(last updated 3 years ago). These have been replaced withtokio-retry2, which offers enhanced features for exponential backoff. Additionally,Derivativewas removed as it is no longer maintained.Improved Retry Functionality: The new
tokio-retry2crate includes better jitter control, ensuring consistent exponential backoff intervals without erratic timings. The previous implementation produced inconsistent retry intervals (e.g., 192ms, 110ms, 900ms). Withtokio-retry2, the jitter range is controlled, maintaining a steady exponential backoff. For slot refresh retries, the strategy has been updated toExponentialFactorBackoff, resulting in attempts with intervals such as[0ms, 400-600ms, 800-1200ms].Issue link
This Pull Request is linked to issue (URL): closes #2669
Checklist
Before submitting the PR make sure the following are checked: