Skip to content

Commit

Permalink
fix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Apr 16, 2024
1 parent 274dc76 commit a109037
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
13 changes: 8 additions & 5 deletions cluster-endpoints/src/grpc/grpc_accounts_streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ use std::{
time::Duration,
};

use geyser_grpc_connector::yellowstone_grpc_util::{
connect_with_timeout_with_buffers, GeyserGrpcClientBufferConfig,
};
use geyser_grpc_connector::{GeyserGrpcClient, GeyserGrpcClientResult, GrpcSourceConfig};
use geyser_grpc_connector::yellowstone_grpc_util::{connect_with_timeout_with_buffers, GeyserGrpcClientBufferConfig};
use itertools::Itertools;
use solana_lite_rpc_core::{
commitment_utils::Commitment,
Expand Down Expand Up @@ -111,9 +113,8 @@ pub fn start_account_streaming_tasks(
ping: None,
};


let mut client = create_connection(&grpc_config).await?;

let account_stream = client.subscribe_once2(program_subscription).await.unwrap();

// each account subscription batch will require individual stream
Expand Down Expand Up @@ -213,7 +214,9 @@ pub fn start_account_streaming_tasks(
})
}

async fn create_connection(grpc_config: &GrpcSourceConfig) -> GeyserGrpcClientResult<GeyserGrpcClient<impl Interceptor + Sized>> {
async fn create_connection(
grpc_config: &GrpcSourceConfig,
) -> GeyserGrpcClientResult<GeyserGrpcClient<impl Interceptor + Sized>> {
connect_with_timeout_with_buffers(
grpc_config.grpc_addr.clone(),
grpc_config.grpc_x_token.clone(),
Expand All @@ -226,7 +229,7 @@ async fn create_connection(grpc_config: &GrpcSourceConfig) -> GeyserGrpcClientRe
stream_window: Some(4194304),
},
)
.await
.await
}

pub fn create_grpc_account_streaming(
Expand Down
33 changes: 17 additions & 16 deletions cluster-endpoints/src/grpc_subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ use crate::grpc_multiplex::{
};
use anyhow::Context;
use futures::StreamExt;
use geyser_grpc_connector::yellowstone_grpc_util::{
connect_with_timeout_with_buffers, GeyserGrpcClientBufferConfig,
};
use geyser_grpc_connector::GrpcSourceConfig;
use itertools::Itertools;
use log::trace;
Expand Down Expand Up @@ -36,13 +39,10 @@ use std::cell::OnceCell;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;
use geyser_grpc_connector::yellowstone_grpc_util::{connect_with_timeout_with_buffers, GeyserGrpcClientBufferConfig};
use tokio::sync::{broadcast, Notify};
use tracing::trace_span;
use yellowstone_grpc_proto::geyser::subscribe_update::UpdateOneof;
use yellowstone_grpc_proto::geyser::{
CommitmentLevel, SubscribeRequestFilterBlocks
};
use yellowstone_grpc_proto::geyser::{CommitmentLevel, SubscribeRequestFilterBlocks};

use crate::rpc_polling::vote_accounts_and_cluster_info_polling::{
poll_cluster_info, poll_vote_accounts,
Expand Down Expand Up @@ -291,18 +291,19 @@ pub fn create_block_processing_task(
);

// connect to grpc
let mut client =
connect_with_timeout_with_buffers(
grpc_addr.clone(), grpc_x_token.clone(),
None,
Some(Duration::from_secs(10)),
Some(Duration::from_secs(10)),
GeyserGrpcClientBufferConfig {
buffer_size: Some(65536),
conn_window: Some(5242880),
stream_window: Some(4194304),
},
).await?;
let mut client = connect_with_timeout_with_buffers(
grpc_addr.clone(),
grpc_x_token.clone(),
None,
Some(Duration::from_secs(10)),
Some(Duration::from_secs(10)),
GeyserGrpcClientBufferConfig {
buffer_size: Some(65536),
conn_window: Some(5242880),
stream_window: Some(4194304),
},
)
.await?;
let mut stream = tokio::select! {
res = client
.subscribe_once(
Expand Down

0 comments on commit a109037

Please sign in to comment.