fix: update_mpoint_cache state变动或超时更新设备运行状态
This commit is contained in:
parent
4c3fa8acac
commit
ecb95da787
|
@ -134,7 +134,7 @@ def update_mpoint_cache(cache_key: str, current_cache_val: dict, last_timex: dat
|
||||||
if ep_monitored_id:
|
if ep_monitored_id:
|
||||||
cache.set(f"equipment_{ep_monitored_id}", {"running_state": last_mrs, "running_state_timex": last_timex}, timeout=None)
|
cache.set(f"equipment_{ep_monitored_id}", {"running_state": last_mrs, "running_state_timex": last_timex}, timeout=None)
|
||||||
# 如果state变动则触发函数
|
# 如果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:
|
if ep_belong_id:
|
||||||
ctask_run("apps.em.services.shutdown_or_startup", ep_belong_id, last_timex, Equipment.RUNING)
|
ctask_run("apps.em.services.shutdown_or_startup", ep_belong_id, last_timex, Equipment.RUNING)
|
||||||
if ep_monitored_id:
|
if ep_monitored_id:
|
||||||
|
|
Loading…
Reference in New Issue