mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-16 17:20:33 +00:00
feat(lock): enhance lock management with timeout and ownership tracking (#589)
- Add lock timeout support and track acquisition time in lock state - Improve lock conflict handling with detailed error messages - Optimize lock reuse when already held by same owner - Refactor lock state to store owner info and timeout duration - Update all lock operations to handle new state structure Signed-off-by: junxiang Mu <1948535941@qq.com>
This commit is contained in:
@@ -73,8 +73,11 @@ impl Stream for RetryTimer {
|
||||
//println!("\njitter: {:?}", jitter);
|
||||
//println!("sleep: {sleep:?}");
|
||||
//println!("0000: {:?}", self.random as f64 * jitter / 100_f64);
|
||||
let sleep_ms = sleep.as_millis() as u64;
|
||||
sleep = Duration::from_millis(sleep_ms - (sleep_ms as f64 * (self.random as f64 * jitter / 100_f64)) as u64);
|
||||
let sleep_ms = sleep.as_millis();
|
||||
let reduction = ((sleep_ms as f64) * (self.random as f64 * jitter / 100_f64)).round() as u128;
|
||||
let jittered_ms = sleep_ms.saturating_sub(reduction);
|
||||
let clamped_ms = std::cmp::min(jittered_ms.max(1), u128::from(u64::MAX));
|
||||
sleep = Duration::from_millis(clamped_ms as u64);
|
||||
}
|
||||
//println!("sleep: {sleep:?}");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user