add conf item for exact amount of startup netburst.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
0ba8d1318d
commit
93a43a0eda
3 changed files with 22 additions and 2 deletions
|
@ -245,6 +245,8 @@ pub struct Config {
|
|||
|
||||
#[serde(default = "true_fn")]
|
||||
pub startup_netburst: bool,
|
||||
#[serde(default = "default_startup_netburst_keep")]
|
||||
pub startup_netburst_keep: i64,
|
||||
|
||||
#[serde(default)]
|
||||
pub block_non_admin_invites: bool,
|
||||
|
@ -733,3 +735,5 @@ fn default_url_preview_max_spider_size() -> usize {
|
|||
fn default_new_user_displayname_suffix() -> String { "🏳️⚧️".to_owned() }
|
||||
|
||||
fn default_sentry_traces_sample_rate() -> f32 { 0.15 }
|
||||
|
||||
fn default_startup_netburst_keep() -> i64 { 50 }
|
||||
|
|
|
@ -45,6 +45,7 @@ pub struct Service {
|
|||
pub sender: mpsc::UnboundedSender<(OutgoingKind, SendingEventType, Vec<u8>)>,
|
||||
receiver: Mutex<mpsc::UnboundedReceiver<(OutgoingKind, SendingEventType, Vec<u8>)>>,
|
||||
startup_netburst: bool,
|
||||
startup_netburst_keep: i64,
|
||||
timeout: u64,
|
||||
}
|
||||
|
||||
|
@ -78,6 +79,7 @@ impl Service {
|
|||
receiver: Mutex::new(receiver),
|
||||
maximum_requests: Arc::new(Semaphore::new(config.max_concurrent_requests as usize)),
|
||||
startup_netburst: config.startup_netburst,
|
||||
startup_netburst_keep: config.startup_netburst_keep,
|
||||
timeout: config.sender_timeout,
|
||||
})
|
||||
}
|
||||
|
@ -284,8 +286,10 @@ impl Service {
|
|||
.entry(outgoing_kind.clone())
|
||||
.or_default();
|
||||
|
||||
if entry.len() > 30 {
|
||||
warn!("Dropping some current events: {:?} {:?} {:?}", key, outgoing_kind, event);
|
||||
if self.startup_netburst_keep >= 0
|
||||
&& entry.len() >= usize::try_from(self.startup_netburst_keep).unwrap()
|
||||
{
|
||||
warn!("Dropping unsent event {:?} {:?}", outgoing_kind, String::from_utf8_lossy(&key),);
|
||||
self.db.delete_active_request(key)?;
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue