mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-25 05:26:50 +00:00
refactor: NamespaceLock (nslock), AHM→Heal Crate, and Lock/Clippy Fixes (#1664)
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: weisd <2057561+weisd@users.noreply.github.com> Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
@@ -759,13 +759,17 @@ mod tests {
|
||||
let shard = LockShard::new(0);
|
||||
|
||||
// First acquire a lock that will block the batch operation
|
||||
let blocking_request = ObjectLockRequest::new_write("bucket", "obj1", "blocking_owner");
|
||||
let blocking_request = ObjectLockRequest::new_write(ObjectKey::new("bucket", "obj1"), "blocking_owner")
|
||||
.with_acquire_timeout(Duration::from_secs(1));
|
||||
shard.acquire_lock(&blocking_request).await.unwrap();
|
||||
|
||||
// Now try a batch operation that should fail and clean up properly
|
||||
// Use short acquire timeout so the test fails fast when obj1 is already locked
|
||||
// (default is 60s which would make this test very slow)
|
||||
let requests = vec![
|
||||
ObjectLockRequest::new_read("bucket", "obj2", "batch_owner"), // This should succeed
|
||||
ObjectLockRequest::new_write("bucket", "obj1", "batch_owner"), // This should fail due to existing lock
|
||||
ObjectLockRequest::new_read(ObjectKey::new("bucket", "obj2"), "batch_owner")
|
||||
.with_acquire_timeout(Duration::from_millis(100)), // This should succeed
|
||||
ObjectLockRequest::new_write(ObjectKey::new("bucket", "obj1"), "batch_owner")
|
||||
.with_acquire_timeout(Duration::from_millis(100)), // This should fail due to existing lock
|
||||
];
|
||||
|
||||
let result = shard.acquire_locks_batch(requests, true).await;
|
||||
|
||||
Reference in New Issue
Block a user