From 968f774092c2601af1c6213ba5d509c9d10e866e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Wed, 25 Sep 2024 19:37:33 +0200 Subject: [PATCH 1/3] always create a new event loop in the client and pass it to a new thread --- src/pydase/client/client.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/pydase/client/client.py b/src/pydase/client/client.py index 6a82514..407d5c7 100644 --- a/src/pydase/client/client.py +++ b/src/pydase/client/client.py @@ -8,7 +8,6 @@ import socketio # type: ignore import pydase.components from pydase.client.proxy_loader import ProxyClassMixin, ProxyLoader -from pydase.utils.helpers import current_event_loop_exists from pydase.utils.serialization.deserializer import loads from pydase.utils.serialization.types import SerializedDataService, SerializedObject @@ -109,11 +108,7 @@ class Client: ): self._url = url self._sio = socketio.AsyncClient() - if not current_event_loop_exists(): - self._loop = asyncio.new_event_loop() - asyncio.set_event_loop(self._loop) - else: - self._loop = asyncio.get_event_loop() + self._loop = asyncio.new_event_loop() self.proxy = ProxyClass(sio_client=self._sio, loop=self._loop) """A proxy object representing the remote service, facilitating interaction as if it were local.""" From ec5694fedff870a4b1ca3e8635c0c3a3aaf8980b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Wed, 25 Sep 2024 19:38:09 +0200 Subject: [PATCH 2/3] no need to check for RuntimeError as the loop is always new --- src/pydase/client/client.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/pydase/client/client.py b/src/pydase/client/client.py index 407d5c7..39543d1 100644 --- a/src/pydase/client/client.py +++ b/src/pydase/client/client.py @@ -31,10 +31,7 @@ class NotifyDict(TypedDict): def asyncio_loop_thread(loop: asyncio.AbstractEventLoop) -> None: asyncio.set_event_loop(loop) - try: - loop.run_forever() - except RuntimeError: - logger.debug("Tried starting even loop, but it is running already") + loop.run_forever() class ProxyClass(ProxyClassMixin, pydase.components.DeviceConnection): From 172b50bf773b2077199395eaebef61018a9862e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Wed, 25 Sep 2024 19:38:28 +0200 Subject: [PATCH 3/3] updates to version v0.10.5 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 707c80a..d2f7bd3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pydase" -version = "0.10.4" +version = "0.10.5" description = "A flexible and robust Python library for creating, managing, and interacting with data services, with built-in support for web and RPC servers, and customizable features for diverse use cases." authors = ["Mose Mueller "] readme = "README.md"