From c28853a2dffbcc541109d210741156c80052f1aa Mon Sep 17 00:00:00 2001 From: buffalu <85544055+buffalu@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:04:55 -0600 Subject: [PATCH] Do not use is_startup_completed (#59) --- server/src/geyser_grpc_plugin.rs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/server/src/geyser_grpc_plugin.rs b/server/src/geyser_grpc_plugin.rs index 08c04f0..1b6816c 100644 --- a/server/src/geyser_grpc_plugin.rs +++ b/server/src/geyser_grpc_plugin.rs @@ -55,6 +55,8 @@ pub struct PluginData { /// Highest slot that an account write has been processed for thus far. highest_write_slot: Arc, + /// Only set to true if account_data_notifications_enabled is true + /// Otherwise, will always be false is_startup_completed: AtomicBool, ignore_startup_updates: bool, account_data_notifications_enabled: bool, @@ -217,6 +219,8 @@ impl GeyserPlugin for GeyserGrpcPlugin { data.runtime.shutdown_background(); } + /// Note: this is called only if account_data_notifications_enabled is set to true. + /// Do not use it for anything except for account updates fn notify_end_of_startup(&self) -> PluginResult<()> { self.data .as_ref() @@ -343,10 +347,6 @@ impl GeyserPlugin for GeyserGrpcPlugin { ) -> PluginResult<()> { let data = self.data.as_ref().expect("plugin must be initialized"); - if data.ignore_startup_updates && !data.is_startup_completed.load(Ordering::Relaxed) { - return Ok(()); - } - debug!("Updating slot {:?} at with status {:?}", slot, status); let status = match status { @@ -384,10 +384,6 @@ impl GeyserPlugin for GeyserGrpcPlugin { ) -> PluginResult<()> { let data = self.data.as_ref().expect("plugin must be initialized"); - if data.ignore_startup_updates && !data.is_startup_completed.load(Ordering::Relaxed) { - return Ok(()); - } - let transaction_update = match transaction { ReplicaTransactionInfoVersions::V0_0_1(tx) => TimestampedTransactionUpdate { ts: Some(prost_types::Timestamp::from(SystemTime::now())), @@ -435,10 +431,6 @@ 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.ignore_startup_updates && !data.is_startup_completed.load(Ordering::Relaxed) { - return Ok(()); - } - let block = match block_info { ReplicaBlockInfoVersions::V0_0_1(block) => TimestampedBlockUpdate { ts: Some(prost_types::Timestamp::from(SystemTime::now())), @@ -516,10 +508,6 @@ impl GeyserPlugin for GeyserGrpcPlugin { fn notify_entry(&self, entry: ReplicaEntryInfoVersions) -> PluginResult<()> { let data = self.data.as_ref().expect("plugin must be initialized"); - if data.ignore_startup_updates && !data.is_startup_completed.load(Ordering::Relaxed) { - return Ok(()); - } - let slot_entry = utils::get_slot_and_index_from_replica_entry_info_versions(&entry); debug!(