diff --git a/CHANGELOG b/CHANGELOG index b7426db..f972440 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +1.2.8 +-) Bugfix - It is possible to call bfx.ws.run() from an already running event loop + 1.2.7 -) Added ws support for Python 3.9 and 3.10 diff --git a/bfxapi/version.py b/bfxapi/version.py index 64e75f8..e9e4434 100644 --- a/bfxapi/version.py +++ b/bfxapi/version.py @@ -2,4 +2,4 @@ This module contains the current version of the bfxapi lib """ -__version__ = '1.2.7' +__version__ = '1.2.8' diff --git a/bfxapi/websockets/generic_websocket.py b/bfxapi/websockets/generic_websocket.py index 20ff37a..dcb39a8 100644 --- a/bfxapi/websockets/generic_websocket.py +++ b/bfxapi/websockets/generic_websocket.py @@ -84,8 +84,10 @@ class GenericWebsocket: thread and connection. """ self._start_new_socket() - while True: - time.sleep(1) + event_loop = asyncio.get_event_loop() + if not event_loop or not event_loop.is_running(): + while True: + time.sleep(1) def get_task_executable(self): """ diff --git a/setup.py b/setup.py index cec0c1f..ffda49f 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ from os import path here = path.abspath(path.dirname(__file__)) setup( name='bitfinex-api-py', - version='1.2.7', + version='1.2.8', description='Official Bitfinex Python API', long_description='A Python reference implementation of the Bitfinex API for both REST and websocket interaction', long_description_content_type='text/markdown',