diff --git a/Cargo.lock b/Cargo.lock index 29e2408a1..6f28177a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,6 +317,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05802a5ad4d172eaf796f7047b42d0af9db513585d16d4169660a21613d34b93" dependencies = [ "log", + "rand 0.7.3", "wasm-timer", ] @@ -445,6 +446,7 @@ dependencies = [ "mockall", "mockito", "openssl", + "rand 0.8.5", "regex", "reqwest 0.10.10", "rusoto_core 0.45.0", diff --git a/autoendpoint/Cargo.toml b/autoendpoint/Cargo.toml index 5f98ec051..9a7dc5c7f 100644 --- a/autoendpoint/Cargo.toml +++ b/autoendpoint/Cargo.toml @@ -17,7 +17,7 @@ a2 = { git = "https://github.com/mozilla-services/a2.git", branch = "autoendpoin actix-web = "3.3" actix-rt = "1.1" # 2.0+ requires futures 0.3+ actix-cors = "0.5" -again = { version = "0.1.2", default-features = false, features = ["log"] } +again = { version = "0.1.2", default-features = false, features = ["log", "rand"] } async-trait = "0.1" autopush_common = { path = "../autopush-common" } backtrace = "0.3" @@ -32,6 +32,7 @@ jsonwebtoken = "8.0" lazy_static = "1.4.0" log = "0.4" openssl = "0.10" +rand = "0.8" regex = "1.4" reqwest = "0.10.6" # 0.11+ requires futures 0.3+ rusoto_core = "0.45.0" # 0.46+ requires futures 0.3+ diff --git a/autoendpoint/src/db/retry.rs b/autoendpoint/src/db/retry.rs index cdd496954..b278ff89c 100644 --- a/autoendpoint/src/db/retry.rs +++ b/autoendpoint/src/db/retry.rs @@ -5,7 +5,6 @@ use rusoto_dynamodb::{ DeleteItemError, DescribeTableError, GetItemError, PutItemError, UpdateItemError, }; use std::sync::Arc; -use std::time::Duration; /// Create a retry function for the given error macro_rules! retryable_error { @@ -49,5 +48,5 @@ pub fn retryable_describe_table_error( /// Build an exponential retry policy pub fn retry_policy() -> RetryPolicy { - RetryPolicy::exponential(Duration::from_millis(100)) + RetryPolicy::default().with_jitter(true) }