remote-externalities: retry get child keys query (#4280)

This commit is contained in:
Liam Aharon
2024-04-25 22:01:05 +10:00
committed by GitHub
parent c26cf3f6f2
commit ff2b178206
@@ -830,16 +830,19 @@ where
child_prefix: StorageKey, child_prefix: StorageKey,
at: B::Hash, at: B::Hash,
) -> Result<Vec<StorageKey>, &'static str> { ) -> Result<Vec<StorageKey>, &'static str> {
// This is deprecated and will generate a warning which causes the CI to fail. let retry_strategy =
#[allow(warnings)] FixedInterval::new(Self::KEYS_PAGE_RETRY_INTERVAL).take(Self::MAX_RETRIES);
let child_keys = substrate_rpc_client::ChildStateApi::storage_keys( let get_child_keys_closure = || {
#[allow(deprecated)]
substrate_rpc_client::ChildStateApi::storage_keys(
client, client,
PrefixedStorageKey::new(prefixed_top_key.as_ref().to_vec()), PrefixedStorageKey::new(prefixed_top_key.as_ref().to_vec()),
child_prefix, child_prefix.clone(),
Some(at), Some(at),
) )
.await };
.map_err(|e| { let child_keys =
Retry::spawn(retry_strategy, get_child_keys_closure).await.map_err(|e| {
error!(target: LOG_TARGET, "Error = {:?}", e); error!(target: LOG_TARGET, "Error = {:?}", e);
"rpc child_get_keys failed." "rpc child_get_keys failed."
})?; })?;