Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use is_startup_completed (#59) #61

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions server/src/geyser_grpc_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ pub struct PluginData {
/// Highest slot that an account write has been processed for thus far.
highest_write_slot: Arc<AtomicU64>,

/// 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,
Expand Down Expand Up @@ -219,6 +221,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()
Expand Down Expand Up @@ -345,10 +349,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 {
Expand Down Expand Up @@ -386,10 +386,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())),
Expand Down Expand Up @@ -437,10 +433,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())),
Expand Down