diff --git a/rustfs/src/connect/diagnostics/job.rs b/rustfs/src/connect/diagnostics/job.rs index 02b573e7b..576f62ce0 100644 --- a/rustfs/src/connect/diagnostics/job.rs +++ b/rustfs/src/connect/diagnostics/job.rs @@ -1796,7 +1796,7 @@ mod tests { async fn top_disk_job_collects_service_io_and_preserves_signed_nonce() { let now = Utc::now(); let mut top = disk_envelope(); - top.parameters.duration_millis = 200; + top.parameters.duration_millis = 1_000; top.create_time = now.to_rfc3339_opts(chrono::SecondsFormat::Secs, true); top.expire_time = (now + chrono::Duration::seconds(30)).to_rfc3339_opts(chrono::SecondsFormat::Secs, true); top.parameters.consent_expires_at = diff --git a/rustfs/src/connect/diagnostics/trace_runtime.rs b/rustfs/src/connect/diagnostics/trace_runtime.rs index 1f07a2162..dac9b86ac 100644 --- a/rustfs/src/connect/diagnostics/trace_runtime.rs +++ b/rustfs/src/connect/diagnostics/trace_runtime.rs @@ -1408,7 +1408,7 @@ mod tests { let task_cancel = cancel.clone(); let state_root = state.path().to_path_buf(); let task = tokio::spawn(async move { super::request_local_runtime_profile(&state_root, request, &task_cancel).await }); - tokio::time::timeout(Duration::from_secs(10), async { + tokio::time::timeout(Duration::from_secs(30), async { loop { if super::super::profile_cpu::CollectorLease::acquire().is_err() { break; diff --git a/rustfs/src/startup_entrypoint.rs b/rustfs/src/startup_entrypoint.rs index d2ce05da9..f2e68a335 100644 --- a/rustfs/src/startup_entrypoint.rs +++ b/rustfs/src/startup_entrypoint.rs @@ -1480,7 +1480,8 @@ async fn execute_connect_profile(options: ConnectProfileOpts) -> Result<()> { enabled_build_features(), ), }; - let export = { + + { let capture = async { match options.tool { ConnectProfileTool::Cpu => { @@ -1517,8 +1518,7 @@ async fn execute_connect_profile(options: ConnectProfileOpts) -> Result<()> { } result = capture.as_mut() => result?, } - }; - export + } }; let tool = export.tool; let outcome = export.outcome; diff --git a/rustfs/tests/connect_profile_threads.rs b/rustfs/tests/connect_profile_threads.rs index 4ae8ff1a0..25d80612e 100644 --- a/rustfs/tests/connect_profile_threads.rs +++ b/rustfs/tests/connect_profile_threads.rs @@ -35,7 +35,7 @@ use tokio_util::sync::CancellationToken; #[cfg(target_os = "linux")] use zip::ZipArchive; -static CAPTURE_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(()); +static CAPTURE_LOCK: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(()); fn request() -> ProfileCaptureRequest { let now = SystemTime::now().duration_since(UNIX_EPOCH).expect("current time").as_secs() as i64; @@ -88,7 +88,7 @@ async fn tokio_thread_scope_remains_explicitly_unsupported() { #[cfg(target_os = "linux")] #[tokio::test] async fn native_thread_scope_exports_bounded_redacted_state_counts() { - let _capture = CAPTURE_LOCK.lock().unwrap(); + let _capture = CAPTURE_LOCK.lock().await; let key = connect::DeviceIdentity::generate(); let result = capture_thread_profile(&request(), ThreadProfileScope::NativeThreads, &CancellationToken::new()) .expect("native thread result"); @@ -126,7 +126,7 @@ async fn native_thread_scope_exports_bounded_redacted_state_counts() { #[cfg(target_os = "linux")] #[test] fn native_thread_scope_honors_the_monotonic_deadline() { - let _capture = CAPTURE_LOCK.lock().unwrap(); + let _capture = CAPTURE_LOCK.blocking_lock(); let mut expired = request(); expired.duration = Duration::from_nanos(1); expired.sample_period = Duration::from_nanos(1); @@ -166,7 +166,7 @@ fn thread_profile_rejects_wrong_negotiation_and_cancellation() { #[cfg(target_has_atomic = "64")] #[test] fn service_runtime_profile_observes_the_supplied_two_worker_runtime() { - let _capture = CAPTURE_LOCK.lock().unwrap(); + let _capture = CAPTURE_LOCK.blocking_lock(); let runtime = tokio::runtime::Builder::new_multi_thread() .worker_threads(2) .enable_all()