cryptofeed icon indicating copy to clipboard operation
cryptofeed copied to clipboard

Fail to connect from another process

Open Drake1804 opened this issue 2 years ago • 0 comments

I want to start my script in a separate process. And Cryptofeed is a part of this new process.

p = multiprocessing.Process(target=init_app)
p.start()

but cryptofeed fails by a timeout:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/cryptofeed/connection_handler.py", line 59, in _create_connection
    async with self.conn.connect() as connection:
  File "/usr/local/lib/python3.9/contextlib.py", line 181, in __aenter__
    return await self.gen.__anext__()
  File "/usr/local/lib/python3.9/site-packages/cryptofeed/connection.py", line 104, in connect
    await self._open()
  File "/usr/local/lib/python3.9/site-packages/cryptofeed/connection.py", line 318, in _open
    self.conn = await websockets.connect(self.address, **self.ws_kwargs)
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/client.py", line 647, in __await_impl_timeout__
    return await self.__await_impl__()
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/async_timeout.py", line 169, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.9/site-packages/websockets/legacy/async_timeout.py", line 252, in _do_exit
    raise asyncio.TimeoutError

I've checked with the websocket-client it establishes a connection without any issues. Am I missing something to make it work? Thank you!

Drake1804 avatar Apr 30 '24 18:04 Drake1804