File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ pub enum Fail {
14
14
/// Fail after the first unsuccessful attempt of obtaining a lock.
15
15
#[ default]
16
16
Immediately ,
17
- /// Retry after failure with exponentially longer sleep times to block the current thread.
17
+ /// Retry after failure with quadratically longer sleep times to block the current thread.
18
18
/// Fail once the given duration is exceeded, similar to [Fail::Immediately]
19
19
AfterDurationWithBackoff ( Duration ) ,
20
20
}
@@ -176,7 +176,7 @@ fn lock_with_mode<T>(
176
176
match mode {
177
177
Fail :: Immediately => try_lock ( & lock_path, directory, cleanup) ,
178
178
Fail :: AfterDurationWithBackoff ( time) => {
179
- for wait in backoff:: Exponential :: default_with_random ( ) . until_no_remaining ( time) {
179
+ for wait in backoff:: Quadratic :: default_with_random ( ) . until_no_remaining ( time) {
180
180
attempts += 1 ;
181
181
match try_lock ( & lock_path, directory, cleanup. clone ( ) ) {
182
182
Ok ( v) => return Ok ( ( lock_path, v) ) ,
You can’t perform that action at this time.
0 commit comments