diff --git a/Cargo.toml b/Cargo.toml index 72eedf4..a0dc1f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,7 @@ strip = true [features] default = [] io-uring = ["dep:tokio-uring", "sled/io_uring", "actix-web/experimental-io-uring"] +poll-timer-warnings = [] [dependencies] actix-form-data = "0.7.0-beta.6" diff --git a/src/future.rs b/src/future.rs index 47ab443..5bbf9ec 100644 --- a/src/future.rs +++ b/src/future.rs @@ -147,13 +147,25 @@ where } if elapsed > Duration::from_secs(1) { + #[cfg(feature = "poll-timer-warnings")] tracing::warn!( "Future {} polled for {} seconds", this.name, elapsed.as_secs() ); + + #[cfg(not(feature = "poll-timer-warnings"))] + tracing::debug!( + "Future {} polled for {} seconds", + this.name, + elapsed.as_secs() + ); } else if elapsed > Duration::from_millis(1) { + #[cfg(feature = "poll-timer-warnings")] tracing::warn!("Future {} polled for {} ms", this.name, elapsed.as_millis()); + + #[cfg(not(feature = "poll-timer-warnings"))] + tracing::debug!("Future {} polled for {} ms", this.name, elapsed.as_millis()); } else if elapsed > Duration::from_micros(200) { tracing::debug!( "Future {} polled for {} microseconds",