Skip to content

Commit

Permalink
Upgrade retry-policies (#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra authored May 10, 2024
1 parent 9911cc0 commit 5b24f15
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
7 changes: 2 additions & 5 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions lib/just-retry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ version.workspace = true
license = "MIT OR Apache-2.0"

[dependencies]
chrono = { version = "0.4.38", default-features = false, features = ["std"] }
retry-policies = "0.3.0"
retry-policies = "0.4.0"
tokio = { version = "1.37.0", features = ["time"] }
tracing = "0.1.40"

Expand Down
7 changes: 3 additions & 4 deletions lib/just-retry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@ where
n_past_retries: u32,
) -> ControlFlow<(), Duration> {
if let RetryDecision::Retry { execute_after } =
self.should_retry(request_start_time.as_time().into(), n_past_retries)
self.should_retry(request_start_time.as_time(), n_past_retries)
{
let now = chrono::DateTime::from(SystemTime::now());
let delta = (execute_after - now)
.to_std()
let delta = execute_after
.duration_since(SystemTime::now())
.expect("Some major clock fuckery happened");

ControlFlow::Continue(delta)
Expand Down

0 comments on commit 5b24f15

Please sign in to comment.