From be3011c56548c242c9f8cf1f0c515be4bcf6d775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Tue, 6 Aug 2024 11:18:27 +0200 Subject: [PATCH] adapt device connection component to use @task decorator --- src/pydase/components/device_connection.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pydase/components/device_connection.py b/src/pydase/components/device_connection.py index cf98a62..b7b648c 100644 --- a/src/pydase/components/device_connection.py +++ b/src/pydase/components/device_connection.py @@ -1,6 +1,7 @@ import asyncio import pydase.data_service +import pydase.task class DeviceConnection(pydase.data_service.DataService): @@ -52,7 +53,6 @@ class DeviceConnection(pydase.data_service.DataService): def __init__(self) -> None: super().__init__() self._connected = False - self._autostart_tasks["_handle_connection"] = () # type: ignore self._reconnection_wait_time = 10.0 def connect(self) -> None: @@ -70,6 +70,7 @@ class DeviceConnection(pydase.data_service.DataService): """ return self._connected + @pydase.task.task(autostart=True) async def _handle_connection(self) -> None: """Automatically tries reconnecting to the device if it is not connected. This method leverages the `connect` method and the `connected` property to