Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
hadjiszs committed Jul 10, 2023
1 parent a7db6fc commit 0934e91
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/topos-tce-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async-trait.workspace = true
axum.workspace = true
base64.workspace = true
futures.workspace = true
lazy_static.workspace = true
hex.workspace = true
http.workspace = true
hyper.workspace = true
Expand Down
10 changes: 10 additions & 0 deletions crates/topos-tce-api/src/constant.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use lazy_static::lazy_static;

lazy_static! {
/// Size of the grpc internal command channel
pub static ref GRPC_COMMAND_CHANNEL_SIZE: usize =
std::env::var("TOPOS_API_COMMAND_CHANNEL_SIZE")
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(2048);
}
1 change: 1 addition & 0 deletions crates/topos-tce-api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod constant;
mod graphql;
mod grpc;
mod metadata_map;
Expand Down
5 changes: 3 additions & 2 deletions crates/topos-tce-api/src/runtime/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use topos_core::api::grpc::tce::v1::StatusResponse;
use topos_tce_storage::StorageClient;

use crate::{
graphql::builder::ServerBuilder as GraphQLBuilder, grpc::builder::ServerBuilder,
constant, graphql::builder::ServerBuilder as GraphQLBuilder, grpc::builder::ServerBuilder,
metrics::builder::ServerBuilder as MetricsBuilder, Runtime, RuntimeClient, RuntimeEvent,
};

Expand Down Expand Up @@ -61,7 +61,8 @@ impl RuntimeBuilder {
}

pub async fn build_and_launch(mut self) -> (RuntimeClient, impl Stream<Item = RuntimeEvent>) {
let (command_sender, internal_runtime_command_receiver) = mpsc::channel(2048);
let (command_sender, internal_runtime_command_receiver) =
mpsc::channel(*constant::GRPC_COMMAND_CHANNEL_SIZE);
let (api_event_sender, api_event_receiver) = mpsc::channel(2048);

let (health_reporter, tce_status, grpc) = ServerBuilder::default()
Expand Down
6 changes: 6 additions & 0 deletions crates/topos-tce-broadcast/src/constant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ lazy_static! {
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(2048);
/// Size of the double echo event channel
pub static ref EVENT_CHANNEL_SIZE: usize =
std::env::var("TOPOS_DOUBLE_ECHO_EVENT_CHANNEL_SIZE")
.ok()
.and_then(|s| s.parse().ok())
.unwrap_or(2048);
/// Capacity alert threshold for the double echo command channel
pub static ref COMMAND_CHANNEL_CAPACITY: usize = COMMAND_CHANNEL_SIZE
.checked_mul(10)
Expand Down
2 changes: 1 addition & 1 deletion crates/topos-tce-broadcast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl ReliableBroadcastClient {
) -> (Self, impl Stream<Item = Result<ProtocolEvents, ()>>) {
let (subscriptions_view_sender, subscriptions_view_receiver) =
mpsc::channel::<SubscriptionsView>(2048);
let (event_sender, event_receiver) = broadcast::channel(2048);
let (event_sender, event_receiver) = broadcast::channel(*constant::EVENT_CHANNEL_SIZE);
let (command_sender, command_receiver) = mpsc::channel(*constant::COMMAND_CHANNEL_SIZE);
let (double_echo_shutdown_channel, double_echo_shutdown_receiver) =
mpsc::channel::<oneshot::Sender<()>>(1);
Expand Down

0 comments on commit 0934e91

Please sign in to comment.