From 0e8540417f3e2db4847cdc4b4ad4c91aa74ac4f9 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Thu, 7 Feb 2019 15:07:10 -0800 Subject: [PATCH] Add get_next_last_id --- src/thin_client.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/thin_client.rs b/src/thin_client.rs index c2d0599978..c255b99005 100644 --- a/src/thin_client.rs +++ b/src/thin_client.rs @@ -262,6 +262,19 @@ impl ThinClient { } } + /// Request a new last Entry ID from the server. This method blocks + /// until the server sends a response. + pub fn get_next_last_id(&mut self, previous_last_id: &Hash) -> Hash { + loop { + let last_id = self.get_last_id(); + if last_id != *previous_last_id { + break last_id; + } + debug!("Got same last_id ({:?}), will retry...", last_id); + sleep(Duration::from_millis(100)); + } + } + pub fn submit_poll_balance_metrics(elapsed: &Duration) { solana_metrics::submit( influxdb::Point::new("thinclient")