Skip to content
Snippets Groups Projects
Commit 94df9cdb authored by Timo Kösters's avatar Timo Kösters
Browse files

Merge branch 'Nyaaori/prev_events-config-option' into 'next'

Make prev_events fetch limit configurable

See merge request famedly/conduit!422
parents b231d7f1 7c196f4e
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,8 @@ pub struct Config {
pub max_request_size: u32,
#[serde(default = "default_max_concurrent_requests")]
pub max_concurrent_requests: u16,
#[serde(default = "default_max_fetch_prev_events")]
pub max_fetch_prev_events: u16,
#[serde(default = "false_fn")]
pub allow_registration: bool,
#[serde(default = "true_fn")]
......@@ -249,6 +251,10 @@ fn default_max_concurrent_requests() -> u16 {
100
}
fn default_max_fetch_prev_events() -> u16 {
100_u16
}
fn default_log() -> String {
"warn,state_res=warn,_=off,sled=off".to_owned()
}
......
......@@ -222,6 +222,10 @@ pub fn max_request_size(&self) -> u32 {
self.config.max_request_size
}
pub fn max_fetch_prev_events(&self) -> u16 {
self.config.max_fetch_prev_events
}
pub fn allow_registration(&self) -> bool {
self.config.allow_registration
}
......
......@@ -1226,7 +1226,7 @@ async fn fetch_unknown_prev_events(
.await
.pop()
{
if amount > 100 {
if amount > services().globals.max_fetch_prev_events() {
// Max limit reached
warn!("Max prev event limit reached!");
graph.insert(prev_event_id.clone(), HashSet::new());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment