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:
parent
996fe0686b
commit
286279cdf5
2 changed files with 13 additions and 0 deletions
|
@ -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"
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue