File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ pub enum Fail {
1414 /// Fail after the first unsuccessful attempt of obtaining a lock.
1515 #[ default]
1616 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.
1818 /// Fail once the given duration is exceeded, similar to [Fail::Immediately]
1919 AfterDurationWithBackoff ( Duration ) ,
2020}
@@ -176,7 +176,7 @@ fn lock_with_mode<T>(
176176 match mode {
177177 Fail :: Immediately => try_lock ( & lock_path, directory, cleanup) ,
178178 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) {
180180 attempts += 1 ;
181181 match try_lock ( & lock_path, directory, cleanup. clone ( ) ) {
182182 Ok ( v) => return Ok ( ( lock_path, v) ) ,
You can’t perform that action at this time.
0 commit comments