Skip to content

Commit c3d1403

Browse files
committed
config: Add a timeout option for the ethereum client
1 parent faeefc2 commit c3d1403

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/aleph/chains/ethereum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737

3838
def get_web3(config) -> Web3:
39-
web3 = Web3(Web3.HTTPProvider(config.ethereum.api_url.value))
39+
web3 = Web3(Web3.HTTPProvider(config.ethereum.api_url.value, request_kwargs={'timeout': config.ethereum.client_timeout}))
4040
if config.ethereum.chain_id.value == 4: # rinkeby
4141
web3.middleware_onion.inject(geth_poa_middleware, layer=0)
4242
web3.middleware_onion.add(local_filter_middleware)

src/aleph/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ def get_defaults():
122122
"max_gas_price": 150000000000,
123123
# Authorized publishers for sync events.
124124
"authorized_emitters": ["0x23eC28598DCeB2f7082Cc3a9D670592DfEd6e0dC"],
125+
# http client timeout, default 60s
126+
"client_timeout": 60
125127
},
126128
"tezos": {
127129
# Whether to fetch transactions from Tezos.

0 commit comments

Comments
 (0)