2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 03:11:24 +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]
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",