From 85fce01834fab523c81884c19fe937460337a1eb Mon Sep 17 00:00:00 2001 From: caoqianming Date: Sun, 28 Apr 2024 14:56:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20shutdown=5For=5Fstartup=20=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/em/services.py | 3 +-- apps/enm/services.py | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/em/services.py b/apps/em/services.py index c8a7719d..8bcab525 100644 --- a/apps/em/services.py +++ b/apps/em/services.py @@ -4,7 +4,6 @@ from apps.mtm.models import Mgroup import datetime from django.core.cache import cache from django.utils.timezone import localtime -from apps.utils.tasks import ctask_run def get_eq_rs(equipId: str): """获取设备运行状态缓存 @@ -26,7 +25,7 @@ def set_eq_rs(equipId, last_timex: datetime, last_mrs: int): cache.set(f"equipment_{equipId}", {"running_state": last_mrs, "running_state_timex": last_timex}, timeout=None) # 更新缓存 if eq_rs_change: - ctask_run.delay("apps.em.services.shutdown_or_startup", equipId, last_timex, last_mrs) + shutdown_or_startup(equipId, last_timex, last_mrs) def shutdown_or_startup(equipId: str, last_timex: datetime, last_mrs): diff --git a/apps/enm/services.py b/apps/enm/services.py index 505c41f1..808c4147 100644 --- a/apps/enm/services.py +++ b/apps/enm/services.py @@ -11,7 +11,6 @@ from django.db import connection, transaction from datetime import datetime, timedelta from apps.utils.decorators import auto_log from django.db import IntegrityError -from apps.utils.tasks import ctask_run from .serializers import MpointSerializer from apps.enp.models import EnvData from apps.em.models import Equipment