Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
janlegner committed Jun 3, 2024
2 parents 25741b3 + 26da0c0 commit e8e0d00
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ help:
@echo " image builds $(name) docker image"
@echo " help show this help"

.PHONY: build-all build-server build-server-release run-server clean run-client run-client-local
.PHONY: build-all build-server build-server-release run-server clean run-client run-client-local run-client-rpc-devnet run-client-rpc-mainnet run-client-blackhole
.DEFAULT_GOAL := build-all

CERT_DIR = certs
Expand Down Expand Up @@ -59,6 +59,13 @@ run-server-local: build-server
--tls-grpc-server-key ./certs/localhost.key \
--tls-grpc-ca-cert ./certs/ca.cert \

run-client: build-client
cargo run --bin mtx-client -- \
--tls-grpc-ca-cert ./certs/ca.cert \
--grpc-urls-file ./client.yml \
--tls-grpc-client-key ./certs/client.$(client).key \
--tls-grpc-client-cert ./certs/client.$(client).cert \

run-client-rpc-devnet: build-client
cargo run --bin mtx-client -- \
--tls-grpc-ca-cert ./certs/ca.cert \
Expand Down
13 changes: 13 additions & 0 deletions client/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use forwarder::ForwardedTransaction;
use log::{error, info};
use signal_hook_tokio::Signals;
use solana_sdk::signature::read_keypair_file;
use std::panic;
use std::process;
use structopt::StructOpt;
use tokio::{
sync::{mpsc::UnboundedSender, RwLock},
Expand Down Expand Up @@ -64,8 +66,19 @@ struct Params {
throttle_parallel: usize,
}

fn setup_panic_hook() {
let hook = panic::take_hook();
panic::set_hook(Box::new(move |info| {
hook(info);
error!("panic_hook forcing exit");
process::exit(1);
}));
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
setup_panic_hook();

env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();

let params = Params::from_args();
Expand Down
5 changes: 3 additions & 2 deletions server/balancer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::grpc_server::{self, build_tx_message_envelope};
use crate::metrics;
use crate::solana_service::{get_tpu_by_identity, leaders_stream};
use crate::{N_CONSUMERS, N_COPIES, NODES_REFRESH_SECONDS};
use crate::{NODES_REFRESH_SECONDS, N_CONSUMERS, N_COPIES};
use jsonrpc_http_server::*;
use log::{error, info};
use rand::rngs::StdRng;
Expand Down Expand Up @@ -207,7 +207,8 @@ pub fn balancer_updater(
);

let mut refresh_cluster_nodes_hint = Box::pin(
tokio_stream::iter(std::iter::repeat(())).throttle(tokio::time::Duration::from_secs(NODES_REFRESH_SECONDS)),
tokio_stream::iter(std::iter::repeat(()))
.throttle(tokio::time::Duration::from_secs(NODES_REFRESH_SECONDS)),
);

let mut tpu_by_identity = Default::default();
Expand Down
2 changes: 1 addition & 1 deletion server/solana_service.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{ N_LEADERS, LEADER_REFRESH_SECONDS };
use crate::{metrics, rpc_server::Mode};
use crate::{LEADER_REFRESH_SECONDS, N_LEADERS};
use log::{debug, error, info};
use solana_client::{
nonblocking::pubsub_client::PubsubClient, rpc_client::RpcClient,
Expand Down

0 comments on commit e8e0d00

Please sign in to comment.