Control warn level for long polls via cargo feature
All checks were successful
/ clippy (push) Successful in 2m5s
/ tests (push) Successful in 2m56s
/ check (aarch64-unknown-linux-musl) (push) Successful in 2m39s
/ check (armv7-unknown-linux-musleabihf) (push) Successful in 2m57s
/ check (x86_64-unknown-linux-musl) (push) Successful in 2m47s

This commit is contained in:
asonix 2024-03-10 20:07:59 -05:00
parent 996fe0686b
commit 286279cdf5
2 changed files with 13 additions and 0 deletions

View file

@ -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"

View file

@ -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",