ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

ConnectionInfo timeout actually results in timeouts occurring 4x the configured value when calling getBlockNumber

Open wwhchung opened this issue 3 years ago • 0 comments

Ethers Version

5.7.0

Search Terms

No response

Describe the Problem

It appears that if you configure a ConnectionInfo timeout value for the provider with no configured network value, any call to getBlockNumber will actually timeout at 4x the timeout value if the node is unresponsive.

For example, setting the timeout to 2000 results in an unresponsive node causing the getBlockNumber call to error after 8 seconds.

This happens because there are 4 timeouts which occur in every method call: _ready() - 1x timeout perform("getBlockNumber") - 1x timeout getNetwork() -> _ready() - 1x timeout

I'm unsure where the 4th timeout occurs.

Code Snippet

provider.getBlockNumber()

Contract ABI

No response

Errors

No response

Environment

No response

Environment (Other)

No response

wwhchung avatar Sep 07 '22 14:09 wwhchung