Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added extra configuration consensus service serve side. #1800

Merged
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion consensus/scp/tests/mock_network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl TestOptions {
values_to_submit: 5000,
submissions_per_sec: 20000,
max_slot_proposed_values: 100,
allowed_test_time: Duration::from_secs(300),
allowed_test_time: Duration::from_secs(500),
log_flush_delay: Duration::from_millis(50),
scp_timebase: Duration::from_millis(1000),
validity_fn: Arc::new(test_utils::trivial_validity_fn::<String>),
Expand Down
6 changes: 5 additions & 1 deletion consensus/service/src/consensus_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,16 @@ impl<
.build(),
);

let server_builder = ServerBuilder::new(env)
let server_builder = ServerBuilder::new(env.clone())
.register_service(client_service)
.register_service(blockchain_service)
.register_service(health_service)
.register_service(attested_service)
.register_service(build_info_service)
.channel_args(
<ServerBuilder as ConnectionUriGrpcioServer>::default_channel_builder(env)
.build_args(),
)
integral-llc marked this conversation as resolved.
Show resolved Hide resolved
.bind_using_uri(&self.config.client_listen_uri, self.logger.clone());

let mut server = server_builder.build().unwrap();
Expand Down
20 changes: 19 additions & 1 deletion util/grpc/src/grpcio_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub trait ConnectionUriGrpcioChannel {
fn default_channel_builder(env: Arc<Environment>) -> ChannelBuilder {
ChannelBuilder::new(env)
.keepalive_permit_without_calls(true)
.keepalive_time(Duration::from_secs(1))
.keepalive_time(Duration::from_secs(10))
.keepalive_timeout(Duration::from_secs(20))
.max_reconnect_backoff(Duration::from_millis(2000))
.initial_reconnect_backoff(Duration::from_millis(1000))
Expand Down Expand Up @@ -61,6 +61,19 @@ pub trait ConnectionUriGrpcioServer {
/// hot-reloading certificates when TLS is used.
#[must_use]
fn bind_using_uri(self, uri: &impl ConnectionUri, logger: Logger) -> Self;

integral-llc marked this conversation as resolved.
Show resolved Hide resolved
/// Create the default channel settings for server
fn default_channel_builder(env: Arc<Environment>) -> ChannelBuilder {
ChannelBuilder::new(env)
.keepalive_permit_without_calls(true)
.keepalive_time(Duration::from_secs(10))
.keepalive_timeout(Duration::from_secs(20))
.http2_min_recv_ping_interval_without_data(Duration::from_secs(5))
}

/// Set the channel args to our defaults.
#[must_use]
fn set_default_channel_args(self, env: Arc<Environment>) -> Self;
}

impl ConnectionUriGrpcioServer for ServerBuilder {
Expand All @@ -86,4 +99,9 @@ impl ConnectionUriGrpcioServer for ServerBuilder {
self.bind(uri.host(), uri.port())
}
}

/// Set the channel args to our defaults.
fn set_default_channel_args(self, env: Arc<Environment>) -> Self {
self.channel_args(Self::default_channel_builder(env).build_args())
}
}