Skip to content

Commit

Permalink
skip startup
Browse files Browse the repository at this point in the history
  • Loading branch information
buffalu committed Apr 8, 2024
1 parent 22f1d3c commit 9a20db7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions server/src/geyser_grpc_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct PluginData {
highest_write_slot: Arc<AtomicU64>,

is_startup_completed: AtomicBool,
stream_state_on_startup: bool
ignore_startup_updates: bool
}

#[derive(Default)]
Expand All @@ -70,7 +70,7 @@ pub struct PluginConfig {
pub slot_update_buffer_size: usize,
pub block_update_buffer_size: usize,
pub transaction_update_buffer_size: usize,
pub stream_state_on_startup: Option<bool>
pub skip_startup_stream: Option<bool>
}

impl GeyserPlugin for GeyserGrpcPlugin {
Expand Down Expand Up @@ -140,8 +140,8 @@ impl GeyserPlugin for GeyserGrpcPlugin {
transaction_update_sender,
highest_write_slot,
is_startup_completed: AtomicBool::new(false),
// true to keep backwards compatability
stream_state_on_startup: config.stream_state_on_startup.unwrap_or(true)
// don't skip startup to keep backwards compatability
ignore_startup_updates: config.skip_startup_stream.unwrap_or(false)
});
info!("plugin data initialized");

Expand Down Expand Up @@ -171,7 +171,7 @@ impl GeyserPlugin for GeyserGrpcPlugin {
) -> PluginResult<()> {
let data = self.data.as_ref().expect("plugin must be initialized");

if !data.is_startup_completed.load(Ordering::Relaxed) && !data.stream_state_on_startup {
if data.ignore_startup_updates && !data.is_startup_completed.load(Ordering::Relaxed) {
return Ok(());
}

Expand Down Expand Up @@ -280,7 +280,7 @@ impl GeyserPlugin for GeyserGrpcPlugin {
) -> PluginResult<()> {
let data = self.data.as_ref().expect("plugin must be initialized");

if !data.is_startup_completed.load(Ordering::Relaxed) && !data.stream_state_on_startup {
if data.ignore_startup_updates && !data.is_startup_completed.load(Ordering::Relaxed) {
return Ok(());
}

Expand Down Expand Up @@ -321,7 +321,7 @@ impl GeyserPlugin for GeyserGrpcPlugin {
) -> PluginResult<()> {
let data = self.data.as_ref().expect("plugin must be initialized");

if !data.is_startup_completed.load(Ordering::Relaxed) && !data.stream_state_on_startup {
if data.ignore_startup_updates && !data.is_startup_completed.load(Ordering::Relaxed) {
return Ok(());
}

Expand Down Expand Up @@ -372,7 +372,7 @@ impl GeyserPlugin for GeyserGrpcPlugin {
fn notify_block_metadata(&self, block_info: ReplicaBlockInfoVersions) -> PluginResult<()> {
let data = self.data.as_ref().expect("plugin must be initialized");

if !data.is_startup_completed.load(Ordering::Relaxed) && !data.stream_state_on_startup {
if data.ignore_startup_updates && !data.is_startup_completed.load(Ordering::Relaxed) {
return Ok(());
}

Expand Down

0 comments on commit 9a20db7

Please sign in to comment.