From 9257e040c4f633275af018049570e3838e1c84d9 Mon Sep 17 00:00:00 2001 From: jpbogle Date: Fri, 3 Mar 2023 19:54:08 -0700 Subject: [PATCH] Separate slots --- src/postgres_client/mod.rs | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/postgres_client/mod.rs b/src/postgres_client/mod.rs index fe11e6a..a2fad97 100644 --- a/src/postgres_client/mod.rs +++ b/src/postgres_client/mod.rs @@ -211,17 +211,24 @@ impl PostgresClient for SimplePostgresClient { // flush slots let mut measure = Measure::start("geyser-plugin-postgres-flush-slots-us"); - let query = &self - .slots_at_startup - .drain() - .map(|s| SlotHandler::update(s, None, SlotStatus::Rooted)) - .collect::>() - .join(""); - if let Err(err) = client.batch_execute(&query) { - return Err(GeyserPluginError::Custom(Box::new(GeyserPluginPostgresError::DataSchemaError { - msg: format!("[notify_end_of_startup][flush_slots] error=[{}]", err), - }))); - }; + for s in &self.slots_at_startup { + if let Err(err) = client.batch_execute(&SlotHandler::update(*s, None, SlotStatus::Rooted)) { + return Err(GeyserPluginError::Custom(Box::new(GeyserPluginPostgresError::DataSchemaError { + msg: format!("[notify_end_of_startup][flush_slots] error=[{}]", err), + }))); + }; + } + // let query = &self + // .slots_at_startup + // .drain() + // .map(|s| SlotHandler::update(s, None, SlotStatus::Rooted)) + // .collect::>() + // .join(""); + // if let Err(err) = client.batch_execute(&query) { + // return Err(GeyserPluginError::Custom(Box::new(GeyserPluginPostgresError::DataSchemaError { + // msg: format!("[notify_end_of_startup][flush_slots] error=[{}]", err), + // }))); + // }; measure.stop(); datapoint_info!(