polkascan / py-substrate-interface

Python Substrate Interface
https://polkascan.github.io/py-substrate-interface/
Apache License 2.0
239 stars 111 forks source link

Make websocket timeout configurable #371

Closed johnuopini closed 6 months ago

johnuopini commented 6 months ago

I am having issues with an endpoint that basically hangs and my job stays there forever waiting for timeout as timeout is currently hardcoded to 2**32, can we have a constructor param to specify default timeout?

arjanz commented 6 months ago

It is actually already possible to provide all available options when creating the websocket connection. There are some defaults atm, but nothing is hardcoded.

For example:

substrate = SubstrateInterface(url='ws://127.0.0.1:9944', ws_options={'timeout': 10})

For all available options, see: https://websocket-client.readthedocs.io/en/latest/core.html#websocket._core.create_connection

johnuopini commented 6 months ago

Awesome, at least now searching for "timeout" in the issues might help someone :) Thanks