From debabdfe4d6c777d07b7f9a59bddcf8c461e7046 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Thu, 24 Oct 2024 09:14:00 +0200 Subject: [PATCH] Expose switchover_noisiness argument in create_multi_provider_web3() --- eth_defi/provider/multi_provider.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eth_defi/provider/multi_provider.py b/eth_defi/provider/multi_provider.py index c1826d4d..1bb1d01e 100644 --- a/eth_defi/provider/multi_provider.py +++ b/eth_defi/provider/multi_provider.py @@ -106,6 +106,7 @@ def create_multi_provider_web3( fallback_backoff=1.25, request_kwargs: Optional[Any] = None, session: Optional[Any] = None, + switchover_noisiness=logging.WARNING, ) -> MultiProviderWeb3: """Create a Web3 instance with multi-provider support. @@ -161,6 +162,9 @@ def create_multi_provider_web3( If not given create a default session manager with retry logic. + :param switchover_noisiness: + Log level for messages when one RPC provider fails and we try other one. + :return: Configured Web3 instance with multiple providers """ @@ -213,7 +217,7 @@ def create_multi_provider_web3( for p in call_providers: _fix_provider(p) - fallback_provider = FallbackProvider(call_providers, sleep=fallback_sleep, backoff=fallback_backoff) + fallback_provider = FallbackProvider(call_providers, sleep=fallback_sleep, backoff=fallback_backoff, switchover_noisiness=switchover_noisiness) transact_provider = None if len(transact_endpoints) > 0: transact_endpoint = transact_endpoints[0]