send ping to ES server before inserting data (#8409)

This commit is contained in:
Alfredo Garcia 2024-04-17 16:09:16 -03:00 committed by GitHub
parent 16a39f89d0
commit 2995ea087b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -502,6 +502,12 @@ impl FinalizedState {
let network = self.network();
rt.block_on(async move {
// Send a ping to the server to check if it is available before inserting.
if client.ping().send().await.is_err() {
tracing::error!("Elasticsearch is not available, skipping block indexing");
return;
}
let response = client
.bulk(elasticsearch::BulkParts::Index(
format!("zcash_{}", network.to_string().to_lowercase()).as_str(),