2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 19:31:35 +00:00

Control warn level for long polls via cargo feature

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] [features]
default = [] default = []
io-uring = ["dep:tokio-uring", "sled/io_uring", "actix-web/experimental-io-uring"] io-uring = ["dep:tokio-uring", "sled/io_uring", "actix-web/experimental-io-uring"]
poll-timer-warnings = []
[dependencies] [dependencies]
actix-form-data = "0.7.0-beta.6" actix-form-data = "0.7.0-beta.6"

View file

@ -147,13 +147,25 @@ where
} }
if elapsed > Duration::from_secs(1) { if elapsed > Duration::from_secs(1) {
#[cfg(feature = "poll-timer-warnings")]
tracing::warn!( tracing::warn!(
"Future {} polled for {} seconds", "Future {} polled for {} seconds",
this.name, this.name,
elapsed.as_secs() 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) { } else if elapsed > Duration::from_millis(1) {
#[cfg(feature = "poll-timer-warnings")]
tracing::warn!("Future {} polled for {} ms", this.name, elapsed.as_millis()); 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) { } else if elapsed > Duration::from_micros(200) {
tracing::debug!( tracing::debug!(
"Future {} polled for {} microseconds", "Future {} polled for {} microseconds",