From eb43b3108d81d2f20f22b79dcbf6c1e51aa33b72 Mon Sep 17 00:00:00 2001 From: i701 Date: Sat, 28 Jun 2025 14:49:39 +0500 Subject: [PATCH] Refactor Omada client initialization: move instantiation to add_new_devices_to_omada task --- api/tasks.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/tasks.py b/api/tasks.py index 3c2bf75..d4c1890 100644 --- a/api/tasks.py +++ b/api/tasks.py @@ -15,8 +15,6 @@ logger = logging.getLogger(__name__) env.read_env(os.path.join(BASE_DIR, ".env")) -omada_client = Omada() - @app.task def add(x, y): @@ -64,6 +62,7 @@ def add_new_devices_to_omada(new_devices: list[dict]): :param new_devices: List of new device names to add. """ logger.info("Running add new devices to Omada task...") + omada_client = Omada() omada_client.add_new_devices_to_omada(new_devices)