Skip to content

Commit

Permalink
bug: add jitter to retry (#319)
Browse files Browse the repository at this point in the history
* bug: add jitter to retry

Closes: #318
  • Loading branch information
jrconlin authored Jun 28, 2022
1 parent f40a14a commit 3272fde
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion autoendpoint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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+
Expand Down
3 changes: 1 addition & 2 deletions autoendpoint/src/db/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}

0 comments on commit 3272fde

Please sign in to comment.