mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-22 00:59:07 -05:00
improvement: limit db connection max lifetime
This commit is contained in:
parent
1b2c6f9fca
commit
b6e33f044f
|
@ -76,6 +76,7 @@ pub fn build_pool(
|
|||
.test_on_check_out(true) // no noticeable performance hit
|
||||
.min_idle(Some(min_size))
|
||||
.max_size(max_size)
|
||||
.max_lifetime(Some(Duration::from_secs(60)))
|
||||
.build(manager)
|
||||
.unwrap();
|
||||
info!(
|
||||
|
|
|
@ -637,7 +637,7 @@ async fn nostr_server(
|
|||
if let Some(previous_query) = running_queries.insert(s.id.to_owned(), abandon_query_tx) {
|
||||
previous_query.send(()).ok();
|
||||
}
|
||||
// start a database query
|
||||
// start a database query. this spawns a blocking database query on a worker thread.
|
||||
db::db_query(s, cid.to_owned(), pool.clone(), query_tx.clone(), abandon_query_rx).await;
|
||||
},
|
||||
Err(e) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user