stop subscribing blocks meta

This commit is contained in:
GroovieGermanikus 2024-05-08 16:14:22 +02:00
parent 430847b2c1
commit 61b202af9f
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
1 changed files with 31 additions and 33 deletions

View File

@ -8,7 +8,7 @@ use std::env;
use std::pin::pin; use std::pin::pin;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::atomic::{AtomicU64, Ordering};
use std::time::{SystemTime, UNIX_EPOCH}; use std::time::{Instant, SystemTime, UNIX_EPOCH};
use itertools::Itertools; use itertools::Itertools;
use solana_account_decoder::parse_token::spl_token_ids; use solana_account_decoder::parse_token::spl_token_ids;
use tokio::sync::mpsc::Receiver; use tokio::sync::mpsc::Receiver;
@ -68,9 +68,9 @@ pub async fn main() {
// exit_notify.resubscribe(), // exit_notify.resubscribe(),
// ); // );
let _all_accounts_and_blocksmeta_task = create_geyser_autoconnection_task_with_mpsc( let _all_accounts = create_geyser_autoconnection_task_with_mpsc(
config.clone(), config.clone(),
all_accounts_and_blocksmeta(), all_accounts(),
autoconnect_tx.clone(), autoconnect_tx.clone(),
exit_notify.resubscribe(), exit_notify.resubscribe(),
); );
@ -182,6 +182,7 @@ fn start_tracking_account_consumer(mut geyser_messages_rx: Receiver<Message>, cu
match geyser_messages_rx.recv().await { match geyser_messages_rx.recv().await {
Some(Message::GeyserSubscribeUpdate(update)) => match update.update_oneof { Some(Message::GeyserSubscribeUpdate(update)) => match update.update_oneof {
Some(UpdateOneof::Account(update)) => { Some(UpdateOneof::Account(update)) => {
let started_at = Instant::now();
let now = SystemTime::now(); let now = SystemTime::now();
let account_info = update.account.unwrap(); let account_info = update.account.unwrap();
let account_pk = Pubkey::try_from(account_info.pubkey).unwrap(); let account_pk = Pubkey::try_from(account_info.pubkey).unwrap();
@ -214,9 +215,8 @@ fn start_tracking_account_consumer(mut geyser_messages_rx: Receiver<Message>, cu
.and_modify(|entry| entry.push(now)) .and_modify(|entry| entry.push(now))
.or_insert(vec![now]); .or_insert(vec![now]);
if current_slot != slot { if current_slot != slot && current_slot != 0 {
info!("Slot: {}", slot); info!("New Slot: {}", slot);
if current_slot != 0 {
info!("Slot: {} - account data transferred: {:.2} MiB", slot, *bytes_per_slot.get(&current_slot).unwrap() as f64 / 1024.0 / 1024.0 ); info!("Slot: {} - account data transferred: {:.2} MiB", slot, *bytes_per_slot.get(&current_slot).unwrap() as f64 / 1024.0 / 1024.0 );
info!("Slot: {} - num of update messages: {}", slot, updates_per_slot.get(&current_slot).unwrap()); info!("Slot: {} - num of update messages: {}", slot, updates_per_slot.get(&current_slot).unwrap());
@ -244,10 +244,8 @@ fn start_tracking_account_consumer(mut geyser_messages_rx: Receiver<Message>, cu
); );
} }
} // -- slot changed
}
current_slot = slot; current_slot = slot;
}
} }
None => {} None => {}