fix: update_mpoint_cache state变动或超时更新设备运行状态

This commit is contained in:
caoqianming 2024-04-24 18:13:21 +08:00
parent 4c3fa8acac
commit ecb95da787
1 changed files with 1 additions and 1 deletions

View File

@ -134,7 +134,7 @@ def update_mpoint_cache(cache_key: str, current_cache_val: dict, last_timex: dat
if ep_monitored_id:
cache.set(f"equipment_{ep_monitored_id}", {"running_state": last_mrs, "running_state_timex": last_timex}, timeout=None)
# 如果state变动则触发函数
if last_data["pre_mrs"] != last_mrs:
if last_data["pre_mrs"] != last_mrs or (timezone.now()-last_timex).total_seconds()>30:
if ep_belong_id:
ctask_run("apps.em.services.shutdown_or_startup", ep_belong_id, last_timex, Equipment.RUNING)
if ep_monitored_id: