@ -47,8 +47,17 @@ pub trait MakeableWithProvider {
let mut builder = QuorumProvider ::builder ( ) . quorum ( Quorum ::Majority ) ;
for url in urls . split ( ',' ) {
let http_provider : Http = url . parse ( ) ? ;
// Wrap the inner providers as RetryingProviders rather than the QuorumProvider.
// We've observed issues where the QuorumProvider will first get the latest block
// number and then submit an RPC at that block height, sometimes resulting in the
// second RPC getting serviced by a node that isn't aware of the requested block
// height yet. Retrying at the QuorumProvider level will result in both those RPCs
// being retried, while retrying at the inner provider level will result in only the
// second RPC being retried (the one with the error), which is the desired behavior.
let retrying_provider =
RetryingProvider ::new ( http_provider , Some ( 3 ) , Some ( 1000 ) ) ;
let metrics_provider = self . wrap_rpc_with_metrics (
http_provider ,
retrying _provider,
Url ::parse ( url ) ? ,
& rpc_metrics ,
& middleware_metrics ,
@ -57,8 +66,7 @@ pub trait MakeableWithProvider {
builder = builder . add_provider ( weighted_provider ) ;
}
let quorum_provider = builder . build ( ) ;
let retrying = RetryingProvider ::new ( quorum_provider , Some ( 3 ) , Some ( 1000 ) ) ;
self . wrap_with_metrics ( retrying , locator , signer , middleware_metrics )
self . wrap_with_metrics ( quorum_provider , locator , signer , middleware_metrics )
. await ?
}
Connection ::Http { url } = > {