diff --git a/tests/webdav_stress_tests.rs b/tests/webdav_stress_tests.rs index 70e6d38..b9be158 100644 --- a/tests/webdav_stress_tests.rs +++ b/tests/webdav_stress_tests.rs @@ -169,7 +169,7 @@ impl WebDAVResourceManager { /// Acquire resources for a WebDAV operation pub async fn acquire_operation_permit(&self) -> anyhow::Result { // Wait for semaphore permit - let permit = self.operation_semaphore.acquire().await + let permit = self.operation_semaphore.clone().acquire_owned().await .map_err(|e| anyhow::anyhow!("Failed to acquire operation permit: {}", e))?; // Rate limiting @@ -420,7 +420,7 @@ impl LoopDetectionMonitor { // Store the task handle if let Ok(mut handle) = cleanup_interval.try_lock() { *handle = Some(task); - } + }; } /// Record a directory access for loop detection with circuit breaker protection @@ -523,10 +523,9 @@ impl LoopDetectionMonitor { self.monitoring_active.store(false, Ordering::Relaxed); // Stop cleanup task - if let Ok(mut handle) = self.cleanup_interval.lock().await { - if let Some(task) = handle.take() { - task.abort(); - } + let mut handle = self.cleanup_interval.lock().await; + if let Some(task) = handle.take() { + task.abort(); } // Clear all data to free memory @@ -604,7 +603,7 @@ fn create_stress_test_webdav_service(config: &StressTestConfig) -> Result Result<()> { }; // Acquire directory lock to prevent race conditions on same path - let _dir_lock = resource_mgr.acquire_directory_lock(path).await.lock().await; + let dir_lock_arc = resource_mgr.acquire_directory_lock(path).await; + let _dir_lock = dir_lock_arc.lock().await; match timeout( Duration::from_secs(timeout_secs),