mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-22 09:09:07 -05:00
wip: add configuration for future feature (client concurrent db limits)
This commit is contained in:
parent
43222d44e5
commit
8598e443d8
12
config.toml
12
config.toml
|
@ -62,14 +62,22 @@ reject_future_seconds = 1800
|
||||||
|
|
||||||
[limits]
|
[limits]
|
||||||
# Limit events created per second, averaged over one minute. Must be
|
# Limit events created per second, averaged over one minute. Must be
|
||||||
# an integer. If not set (or set to 0), defaults to unlimited.
|
# an integer. If not set (or set to 0), defaults to unlimited. Note:
|
||||||
#messages_per_sec = 0
|
# this is for the server as a whole, not per-connection.
|
||||||
|
# messages_per_sec = 0
|
||||||
|
|
||||||
# Limit client subscriptions created per second, averaged over one
|
# Limit client subscriptions created per second, averaged over one
|
||||||
# minute. Must be an integer. If not set (or set to 0), defaults to
|
# minute. Must be an integer. If not set (or set to 0), defaults to
|
||||||
# unlimited.
|
# unlimited.
|
||||||
#subscriptions_per_min = 0
|
#subscriptions_per_min = 0
|
||||||
|
|
||||||
|
# UNIMPLEMENTED...
|
||||||
|
# Limit how many concurrent database connections a client can have.
|
||||||
|
# This prevents a single client from starting too many expensive
|
||||||
|
# database queries. Must be an integer. If not set (or set to 0),
|
||||||
|
# defaults to unlimited (subject to subscription limits).
|
||||||
|
#db_conns_per_client = 0
|
||||||
|
|
||||||
# Limit the maximum size of an EVENT message. Defaults to 128 KB.
|
# Limit the maximum size of an EVENT message. Defaults to 128 KB.
|
||||||
# Set to 0 for unlimited.
|
# Set to 0 for unlimited.
|
||||||
#max_event_bytes = 131072
|
#max_event_bytes = 131072
|
||||||
|
|
|
@ -53,7 +53,8 @@ pub struct Retention {
|
||||||
pub struct Limits {
|
pub struct Limits {
|
||||||
pub messages_per_sec: Option<u32>, // Artificially slow down event writing to limit disk consumption (averaged over 1 minute)
|
pub messages_per_sec: Option<u32>, // Artificially slow down event writing to limit disk consumption (averaged over 1 minute)
|
||||||
pub subscriptions_per_min: Option<u32>, // Artificially slow down request (db query) creation to prevent abuse (averaged over 1 minute)
|
pub subscriptions_per_min: Option<u32>, // Artificially slow down request (db query) creation to prevent abuse (averaged over 1 minute)
|
||||||
pub max_event_bytes: Option<usize>, // Maximum size of an EVENT message
|
pub db_conns_per_client: Option<u32>, // How many concurrent database queries (not subscriptions) may a client have?
|
||||||
|
pub max_event_bytes: Option<usize>, // Maximum size of an EVENT message
|
||||||
pub max_ws_message_bytes: Option<usize>,
|
pub max_ws_message_bytes: Option<usize>,
|
||||||
pub max_ws_frame_bytes: Option<usize>,
|
pub max_ws_frame_bytes: Option<usize>,
|
||||||
pub broadcast_buffer: usize, // events to buffer for subscribers (prevents slow readers from consuming memory)
|
pub broadcast_buffer: usize, // events to buffer for subscribers (prevents slow readers from consuming memory)
|
||||||
|
@ -216,6 +217,7 @@ impl Default for Settings {
|
||||||
limits: Limits {
|
limits: Limits {
|
||||||
messages_per_sec: None,
|
messages_per_sec: None,
|
||||||
subscriptions_per_min: None,
|
subscriptions_per_min: None,
|
||||||
|
db_conns_per_client: None,
|
||||||
max_event_bytes: Some(2 << 17), // 128K
|
max_event_bytes: Some(2 << 17), // 128K
|
||||||
max_ws_message_bytes: Some(2 << 17), // 128K
|
max_ws_message_bytes: Some(2 << 17), // 128K
|
||||||
max_ws_frame_bytes: Some(2 << 17), // 128K
|
max_ws_frame_bytes: Some(2 << 17), // 128K
|
||||||
|
|
Loading…
Reference in New Issue
Block a user