1
0
Fork 0
forked from alemi/upub

fix: less noisy errors, slow query filter maybe

This commit is contained in:
əlemi 2024-05-31 01:34:55 +02:00
parent 3c50dba3f8
commit d3750ea8af
Signed by: alemi
GPG key ID: A4895B84D311642C
3 changed files with 3 additions and 2 deletions

View file

@ -83,7 +83,7 @@ impl axum::response::IntoResponse for UpubError {
fn into_response(self) -> axum::response::Response { fn into_response(self) -> axum::response::Response {
// TODO it's kind of jank to hide this print down here, i should probably learn how spans work // TODO it's kind of jank to hide this print down here, i should probably learn how spans work
// in tracing and use the library's features but ehhhh // in tracing and use the library's features but ehhhh
tracing::error!("{self:?}"); tracing::debug!("emitting error response: {self:?}");
match self { match self {
UpubError::Redirect(to) => Redirect::to(&to).into_response(), UpubError::Redirect(to) => Redirect::to(&to).into_response(),
UpubError::Status(status) => status.into_response(), UpubError::Status(status) => status.into_response(),

View file

@ -98,7 +98,7 @@ async fn main() {
.acquire_timeout(std::time::Duration::from_secs(config.datasource.acquire_timeout_seconds)) .acquire_timeout(std::time::Duration::from_secs(config.datasource.acquire_timeout_seconds))
.connect_timeout(std::time::Duration::from_secs(config.datasource.connect_timeout_seconds)) .connect_timeout(std::time::Duration::from_secs(config.datasource.connect_timeout_seconds))
.sqlx_slow_statements_logging_settings( .sqlx_slow_statements_logging_settings(
if config.datasource.slow_query_warn_enable { tracing::log::LevelFilter::Warn } else { tracing::log::LevelFilter::Off }, if config.datasource.slow_query_warn_enable { tracing::log::LevelFilter::Warn } else { tracing::log::LevelFilter::Debug },
std::time::Duration::from_secs(config.datasource.slow_query_warn_seconds) std::time::Duration::from_secs(config.datasource.slow_query_warn_seconds)
); );

View file

@ -75,4 +75,5 @@ impl SideEffects for super::Context {
Ok(()) Ok(())
} }
} }