IDONTWANT message optimisation to cutoff for smaller messages (#6456)

* idontwant message opitmising

* requested changes and linter appeasing

* added the config cli flag

* Merge branch 'unstable' into fix/idontwant-optimise

* cli docs generated

* const declaration

* Hide extra technical cli flag

* passing ci

* Merge branch 'unstable' into fix/idontwant-optimise
This commit is contained in:
hopinheimer
2024-10-17 04:27:56 -04:00
committed by GitHub
parent 7091c789c9
commit 606a113cff
7 changed files with 110 additions and 5 deletions

View File

@@ -659,7 +659,15 @@ pub fn cli_app() -> Command {
.action(ArgAction::Set)
.display_order(0)
)
.arg(
Arg::new("idontwant-message-size-threshold")
.long("idontwant-message-size-threshold")
.help("Specifies the minimum message size for which IDONTWANT messages are sent. \
This an optimization strategy to not send IDONTWANT messages for smaller messages.")
.action(ArgAction::Set)
.hide(true)
.display_order(0)
)
/*
* Monitoring metrics
*/

View File

@@ -1487,6 +1487,20 @@ pub fn set_network_config(
Some(Default::default())
}
};
if let Some(idontwant_message_size_threshold) =
cli_args.get_one::<String>("idontwant-message-size-threshold")
{
config.idontwant_message_size_threshold = idontwant_message_size_threshold
.parse::<usize>()
.map_err(|_| {
format!(
"Invalid idontwant message size threshold value passed: {}",
idontwant_message_size_threshold
)
})?;
}
Ok(())
}