Skip to content

Commit

Permalink
* Add a timeout option for the ethereum client (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
aliel authored Dec 16, 2024
1 parent be8f1ca commit 7543b6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/aleph/chains/ethereum.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@


def get_web3(config) -> Web3:
web3 = Web3(Web3.HTTPProvider(config.ethereum.api_url.value))
web3 = Web3(
Web3.HTTPProvider(
config.ethereum.api_url.value,
request_kwargs={"timeout": config.ethereum.client_timeout.value},
)
)
if config.ethereum.chain_id.value == 4: # rinkeby
web3.middleware_onion.inject(geth_poa_middleware, layer=0)
web3.middleware_onion.add(local_filter_middleware)
Expand Down
2 changes: 2 additions & 0 deletions src/aleph/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ def get_defaults():
"archive_delay": 30,
# Delay in seconds between blockchain message checks.
"message_delay": 30,
# http client timeout, default 60s
"client_timeout": 60,
},
"tezos": {
# Whether to fetch transactions from Tezos.
Expand Down

0 comments on commit 7543b6b

Please sign in to comment.