mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-22 00:59:07 -05:00
improvement: allow queries to be cancelled earlier (before SQL execution)
This commit is contained in:
parent
2b79099cfe
commit
ba4fcd072a
|
@ -344,6 +344,12 @@ impl NostrRepo for SqliteRepo {
|
||||||
db_queue_time, client_id, sub.id
|
db_queue_time, client_id, sub.id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// check before getting a DB connection if the client still wants the results
|
||||||
|
if abandon_query_rx.try_recv().is_ok() {
|
||||||
|
debug!("query cancelled by client (before execution) (cid: {}, sub: {:?})", client_id, sub.id);
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
let mut row_count: usize = 0;
|
let mut row_count: usize = 0;
|
||||||
// cutoff for displaying slow queries
|
// cutoff for displaying slow queries
|
||||||
|
|
Loading…
Reference in New Issue
Block a user