clippy+fmt

This commit is contained in:
GroovieGermanikus 2024-01-31 18:53:07 +01:00
parent 5c568a2602
commit 048ad2be28
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
5 changed files with 10 additions and 27 deletions

2
Cargo.lock generated
View File

@ -1236,7 +1236,7 @@ dependencies = [
[[package]] [[package]]
name = "geyser-grpc-connector" name = "geyser-grpc-connector"
version = "0.50.1+yellowstone.1.12" version = "0.10.1+yellowstone.1.12"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-stream", "async-stream",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "geyser-grpc-connector" name = "geyser-grpc-connector"
version = "0.50.1+yellowstone.1.12" version = "0.10.1+yellowstone.1.12"
edition = "2021" edition = "2021"
description = "Multiplexing and Reconnection on Yellowstone gRPC Geyser client streaming" description = "Multiplexing and Reconnection on Yellowstone gRPC Geyser client streaming"

View File

@ -137,17 +137,6 @@ pub async fn main() {
warn!("Stream aborted"); warn!("Stream aborted");
}); });
// let green_stream = create_geyser_reconnecting_stream(
// green_config.clone(),
// GeyserFilter(CommitmentConfig::confirmed()).blocks_meta(),
// // GeyserFilter(CommitmentConfig::confirmed()).blocks_and_txs(),
// );
// let multiplex_stream = create_multiplexed_stream(
// vec![green_stream],
// BlockMiniExtractor(CommitmentConfig::confirmed()),
// );
// start_example_blockmini_consumer(multiplex_stream);
// "infinite" sleep // "infinite" sleep
sleep(Duration::from_secs(1800)).await; sleep(Duration::from_secs(1800)).await;
} }

View File

@ -1,2 +1,2 @@
[toolchain] [toolchain]
channel = "1.70" channel = "1.73.0"

View File

@ -29,8 +29,6 @@ enum FatalErrorReason {
ConfigurationError, ConfigurationError,
NetworkError, NetworkError,
SubscribeError, SubscribeError,
// everything else
Misc,
} }
/// connect to grpc source performing autoconect if required, /// connect to grpc source performing autoconect if required,
@ -101,21 +99,21 @@ pub fn create_geyser_autoconnection_task(
} }
Err(GeyserGrpcClientError::TonicError(tonic_error)) => { Err(GeyserGrpcClientError::TonicError(tonic_error)) => {
warn!( warn!(
"! connect failed on {} - aborting: {:?}", "connect failed on {} - aborting: {:?}",
grpc_source, tonic_error grpc_source, tonic_error
); );
ConnectionState::FatalError(attempt, FatalErrorReason::NetworkError) ConnectionState::FatalError(attempt, FatalErrorReason::NetworkError)
} }
Err(GeyserGrpcClientError::TonicStatus(tonic_status)) => { Err(GeyserGrpcClientError::TonicStatus(tonic_status)) => {
warn!( warn!(
"! connect failed on {} - retrying: {:?}", "connect failed on {} - retrying: {:?}",
grpc_source, tonic_status grpc_source, tonic_status
); );
ConnectionState::RecoverableConnectionError(attempt) ConnectionState::RecoverableConnectionError(attempt)
} }
Err(GeyserGrpcClientError::SubscribeSendError(send_error)) => { Err(GeyserGrpcClientError::SubscribeSendError(send_error)) => {
warn!( warn!(
"! connect failed with send error on {} - retrying: {:?}", "connect failed with send error on {} - retrying: {:?}",
grpc_source, send_error grpc_source, send_error
); );
ConnectionState::RecoverableConnectionError(attempt) ConnectionState::RecoverableConnectionError(attempt)
@ -149,7 +147,7 @@ pub fn create_geyser_autoconnection_task(
// non-recoverable // non-recoverable
Err(unrecoverable_error) => { Err(unrecoverable_error) => {
error!( error!(
"! subscribe to {} failed with unrecoverable error: {}", "subscribe to {} failed with unrecoverable error: {}",
grpc_source, unrecoverable_error grpc_source, unrecoverable_error
); );
ConnectionState::FatalError( ConnectionState::FatalError(
@ -161,7 +159,7 @@ pub fn create_geyser_autoconnection_task(
} }
Err(_elapsed) => { Err(_elapsed) => {
warn!( warn!(
"! subscribe failed with timeout on {} - retrying", "subscribe failed with timeout on {} - retrying",
grpc_source grpc_source
); );
ConnectionState::RecoverableConnectionError(attempt) ConnectionState::RecoverableConnectionError(attempt)
@ -171,7 +169,7 @@ pub fn create_geyser_autoconnection_task(
ConnectionState::RecoverableConnectionError(attempt) => { ConnectionState::RecoverableConnectionError(attempt) => {
let backoff_secs = 1.5_f32.powi(attempt as i32).min(15.0); let backoff_secs = 1.5_f32.powi(attempt as i32).min(15.0);
info!( info!(
"! waiting {} seconds, then reconnect to {}", "waiting {} seconds, then reconnect to {}",
backoff_secs, grpc_source backoff_secs, grpc_source
); );
sleep(Duration::from_secs_f32(backoff_secs)).await; sleep(Duration::from_secs_f32(backoff_secs)).await;
@ -194,15 +192,11 @@ pub fn create_geyser_autoconnection_task(
warn!("fatal grpc subscribe error - aborting"); warn!("fatal grpc subscribe error - aborting");
return; return;
} }
FatalErrorReason::Misc => {
error!("fatal misc error grpc connection - aborting");
return;
}
}, },
ConnectionState::WaitReconnect(attempt) => { ConnectionState::WaitReconnect(attempt) => {
let backoff_secs = 1.5_f32.powi(attempt as i32).min(15.0); let backoff_secs = 1.5_f32.powi(attempt as i32).min(15.0);
info!( info!(
"! waiting {} seconds, then reconnect to {}", "waiting {} seconds, then reconnect to {}",
backoff_secs, grpc_source backoff_secs, grpc_source
); );
sleep(Duration::from_secs_f32(backoff_secs)).await; sleep(Duration::from_secs_f32(backoff_secs)).await;