chore (backend): show less unhelpful slow query warnings

This commit is contained in:
naskya 2024-06-04 10:50:41 +09:00
parent ebcf75dcd2
commit 6f6cf0cc88
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
2 changed files with 3 additions and 1 deletions

View file

@ -4,6 +4,7 @@ use crate::config::CONFIG;
use once_cell::sync::OnceCell;
use sea_orm::{ConnectOptions, Database, DbConn, DbErr};
use tracing::log::LevelFilter;
use std::time::Duration;
static DB_CONN: OnceCell<DbConn> = OnceCell::new();
@ -18,6 +19,7 @@ async fn init_conn() -> Result<&'static DbConn, DbErr> {
);
let option: ConnectOptions = ConnectOptions::new(database_uri)
.sqlx_logging_level(LevelFilter::Trace)
.sqlx_slow_statements_logging_settings(LevelFilter::Warn, Duration::from_secs(3))
.to_owned();
tracing::info!("initializing connection");

View file

@ -219,7 +219,7 @@ export const db = new DataSource({
: false,
logging: log,
logger: log ? new DbLogger() : undefined,
maxQueryExecutionTime: 300,
maxQueryExecutionTime: 3000,
entities: entities,
migrations: ["../../migration/*.js"],
});