-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
client/cli/src/commands/run_cmd.rs
Outdated
@@ -124,6 +124,9 @@ pub struct RunCmd { | |||
pub ws_port: Option<u16>, | |||
|
|||
/// Maximum number of WS RPC server connections. | |||
/// | |||
/// Default is 100. | |||
// {this is set in client/rpc-servers/src/lib.rs} | |||
#[structopt(long = "ws-max-connections", value_name = "COUNT")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can;t we do something like
#[structopt(long = "ws-max-connections", value_name = "COUNT", default_value="100")]
?
And get rid of sc_rpc_server::WS_MAX_CONNECTION
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also avoid the (likely) miss of the comment needing to be changed if this constant ever changed. grouped in the same lines here would be much easier to spot 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, using default_value
doesn't work with using an Option<>
. So this change would have quite a bit of ripple effect.
For now, I gues, the updated comment will have to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What ripple effect?
Ripple effect being that this has to be changed in quite a view places. We also need a new default value, which I use |
I have no idea, why the CI thinks this PR needs a Polkadot companion. I have done one, and it comes up empty, i.e. no source code changes required. Only So, now what? |
I think we should stick to one pattern. Now, |
@@ -81,7 +81,7 @@ fn new_node(tokio_handle: Handle) -> node_cli::service::NewFullBase { | |||
rpc_http: None, | |||
rpc_ws: None, | |||
rpc_ipc: None, | |||
rpc_ws_max_connections: None, | |||
rpc_ws_max_connections: usize::MAX, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, please don't use usize::MAX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be a sensible alternative? Use usize::MIN
or rely on the Rust language default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will 1024 be good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual default is 100
as implied by the default value for the CLI option.
Regarding the review comment above, we are basically looking for something to use instead of None
because we no longer use an Option<>
.
@@ -344,8 +344,8 @@ pub trait CliConfiguration<DCV: DefaultConfigurationValues = ()>: Sized { | |||
/// Get the RPC websockets maximum connections (`None` if unlimited). | |||
/// | |||
/// By default this is `None`. | |||
fn rpc_ws_max_connections(&self) -> Result<Option<usize>> { | |||
Ok(None) | |||
fn rpc_ws_max_connections(&self) -> Result<usize> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs above are incorrect.
Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
I think a better solution would have been to keep the |
Yeah, whole PR actually isn't worth it. I'm fine to just get rid of it and leave things as they are. |
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
Behavior tripped up a user, adding a note for the command and an internal (only) comment on where this is set.