Skip to content

Commit

Permalink
fix: Adapt to changes in gix-utils
Browse files Browse the repository at this point in the history
`Exponential` was renamed to `Quadratic` in `gix_utils::backoff`.
This updates the use (and comment) in `gix-lock` accordingly.
  • Loading branch information
EliahKagan committed Jan 27, 2025
1 parent d737c4a commit 0be882a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gix-lock/src/acquire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub enum Fail {
/// Fail after the first unsuccessful attempt of obtaining a lock.
#[default]
Immediately,
/// Retry after failure with exponentially longer sleep times to block the current thread.
/// Retry after failure with quadratically longer sleep times to block the current thread.
/// Fail once the given duration is exceeded, similar to [Fail::Immediately]
AfterDurationWithBackoff(Duration),
}
Expand Down Expand Up @@ -176,7 +176,7 @@ fn lock_with_mode<T>(
match mode {
Fail::Immediately => try_lock(&lock_path, directory, cleanup),
Fail::AfterDurationWithBackoff(time) => {
for wait in backoff::Exponential::default_with_random().until_no_remaining(time) {
for wait in backoff::Quadratic::default_with_random().until_no_remaining(time) {
attempts += 1;
match try_lock(&lock_path, directory, cleanup.clone()) {
Ok(v) => return Ok((lock_path, v)),
Expand Down

0 comments on commit 0be882a

Please sign in to comment.