mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-09 21:29:06 -05:00
improvement: clearer and less verbose database logging
This commit is contained in:
parent
699489ebaf
commit
ee0de6f875
10
src/db.rs
10
src/db.rs
|
@ -100,7 +100,6 @@ CREATE INDEX IF NOT EXISTS pubkey_ref_index ON pubkey_ref(referenced_pubkey);
|
||||||
"##;
|
"##;
|
||||||
|
|
||||||
pub fn build_read_pool() -> SqlitePool {
|
pub fn build_read_pool() -> SqlitePool {
|
||||||
info!("Build a connection pool");
|
|
||||||
let config = config::SETTINGS.read().unwrap();
|
let config = config::SETTINGS.read().unwrap();
|
||||||
let db_dir = &config.database.data_directory;
|
let db_dir = &config.database.data_directory;
|
||||||
let full_path = Path::new(db_dir).join(DB_FILE);
|
let full_path = Path::new(db_dir).join(DB_FILE);
|
||||||
|
@ -113,6 +112,10 @@ pub fn build_read_pool() -> SqlitePool {
|
||||||
.max_size(config.database.max_conn)
|
.max_size(config.database.max_conn)
|
||||||
.build(manager)
|
.build(manager)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
info!(
|
||||||
|
"Built a connection pool (min={}, max={})",
|
||||||
|
config.database.min_conn, config.database.max_conn
|
||||||
|
);
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,7 +515,6 @@ fn query_from_sub(sub: &Subscription) -> (String, Vec<Box<dyn ToSql>>) {
|
||||||
for auth in authvec {
|
for auth in authvec {
|
||||||
match hex_range(auth) {
|
match hex_range(auth) {
|
||||||
Some(HexSearch::Exact(ex)) => {
|
Some(HexSearch::Exact(ex)) => {
|
||||||
info!("Exact match for author");
|
|
||||||
auth_searches.push("author=?".to_owned());
|
auth_searches.push("author=?".to_owned());
|
||||||
params.push(Box::new(ex));
|
params.push(Box::new(ex));
|
||||||
}
|
}
|
||||||
|
@ -527,7 +529,7 @@ fn query_from_sub(sub: &Subscription) -> (String, Vec<Box<dyn ToSql>>) {
|
||||||
params.push(Box::new(lower));
|
params.push(Box::new(lower));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
info!("Could not parse hex range from {:?}", auth);
|
info!("Could not parse hex range from author {:?}", auth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -561,7 +563,7 @@ fn query_from_sub(sub: &Subscription) -> (String, Vec<Box<dyn ToSql>>) {
|
||||||
params.push(Box::new(lower));
|
params.push(Box::new(lower));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
info!("Could not parse hex range from {:?}", id);
|
info!("Could not parse hex range from id {:?}", id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user