mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-22 00:59:07 -05:00
improvement: drop slow readers more quickly
This commit is contained in:
parent
eb1d2d717d
commit
2b79099cfe
|
@ -364,9 +364,9 @@ impl NostrRepo for SqliteRepo {
|
|||
if sql_gen_elapsed > Duration::from_millis(10) {
|
||||
debug!("SQL (slow) generated in {:?}", filter_start.elapsed());
|
||||
}
|
||||
// any client that doesn't cause us to generate new rows in 5
|
||||
// any client that doesn't cause us to generate new rows in 2
|
||||
// seconds gets dropped.
|
||||
let abort_cutoff = Duration::from_secs(5);
|
||||
let abort_cutoff = Duration::from_secs(2);
|
||||
let mut slow_first_event;
|
||||
let mut last_successful_send = Instant::now();
|
||||
// execute the query.
|
||||
|
@ -436,8 +436,8 @@ impl NostrRepo for SqliteRepo {
|
|||
return Ok(());
|
||||
}
|
||||
// give the queue a chance to clear before trying again
|
||||
info!("query thread sleeping due to full query_tx (cid: {}, sub: {:?})", client_id, sub.id);
|
||||
thread::sleep(Duration::from_millis(100));
|
||||
debug!("query thread sleeping due to full query_tx (cid: {}, sub: {:?})", client_id, sub.id);
|
||||
thread::sleep(Duration::from_millis(500));
|
||||
}
|
||||
// TODO: we could use try_send, but we'd have to juggle
|
||||
// getting the query result back as part of the error
|
||||
|
|
|
@ -576,7 +576,7 @@ async fn nostr_server(
|
|||
// we will send out the tx handle to any query we generate.
|
||||
// this has capacity for some of the larger requests we see, which
|
||||
// should allow the DB thread to release the handle earlier.
|
||||
let (query_tx, mut query_rx) = mpsc::channel::<db::QueryResult>(20000);
|
||||
let (query_tx, mut query_rx) = mpsc::channel::<db::QueryResult>(20_000);
|
||||
// Create channel for receiving NOTICEs
|
||||
let (notice_tx, mut notice_rx) = mpsc::channel::<Notice>(128);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user