Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
462eb46642 | ||
|
|
cf144d503d |
Generated
+1
-1
@@ -1096,7 +1096,7 @@ checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-rs-relay"
|
name = "nostr-rs-relay"
|
||||||
version = "0.7.10"
|
version = "0.7.11"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bitcoin_hashes",
|
"bitcoin_hashes",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nostr-rs-relay"
|
name = "nostr-rs-relay"
|
||||||
version = "0.7.10"
|
version = "0.7.11"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Greg Heartsfield <scsibug@imap.cc>"]
|
authors = ["Greg Heartsfield <scsibug@imap.cc>"]
|
||||||
description = "A relay implementation for the Nostr protocol"
|
description = "A relay implementation for the Nostr protocol"
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ pub async fn db_query(
|
|||||||
// show pool stats
|
// show pool stats
|
||||||
log_pool_stats(&pool);
|
log_pool_stats(&pool);
|
||||||
// cutoff for displaying slow queries
|
// cutoff for displaying slow queries
|
||||||
let slow_cutoff = Duration::from_millis(1000);
|
let slow_cutoff = Duration::from_millis(2000);
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
let mut slow_first_event;
|
let mut slow_first_event;
|
||||||
if let Ok(conn) = pool.get() {
|
if let Ok(conn) = pool.get() {
|
||||||
@@ -665,9 +665,9 @@ pub async fn db_query(
|
|||||||
);
|
);
|
||||||
first_result = false;
|
first_result = false;
|
||||||
}
|
}
|
||||||
// logging for slow queries; show sub and SQL
|
// logging for slow queries; show sub and SQL.
|
||||||
//
|
// to reduce logging; only show 1/16th of clients (leading 0)
|
||||||
if slow_first_event {
|
if slow_first_event && client_id.starts_with('0') {
|
||||||
info!(
|
info!(
|
||||||
"query req (slow): {:?} (cid: {}, sub: {:?})",
|
"query req (slow): {:?} (cid: {}, sub: {:?})",
|
||||||
sub, client_id, sub.id
|
sub, client_id, sub.id
|
||||||
@@ -690,9 +690,8 @@ pub async fn db_query(
|
|||||||
sub.id
|
sub.id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// check if this is still active
|
// check if this is still active; every 100 rows
|
||||||
// TODO: check every N rows
|
if row_count % 100 == 0 && abandon_query_rx.try_recv().is_ok() {
|
||||||
if abandon_query_rx.try_recv().is_ok() {
|
|
||||||
debug!("query aborted (cid: {}, sub: {:?})", client_id, sub.id);
|
debug!("query aborted (cid: {}, sub: {:?})", client_id, sub.id);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user