fix : em/service 修改update_time
This commit is contained in:
parent
779bd763a1
commit
6a20445ddd
|
@ -30,9 +30,11 @@ def set_eq_rs(equipId, last_timex: datetime, last_mrs: int):
|
|||
if eq_rs_cache["running_state"] != last_mrs: # 如果状态变动了要调用方法否则只需更新缓存
|
||||
eq_rs_change = True
|
||||
update_time = now
|
||||
elif now > eq_rs_cache.get('update_time', baseTime) + ten_minutes: # 如果当前时间大于缓存时间5分钟则更新
|
||||
elif now > eq_rs_cache.get('update_time', baseTime) + ten_minutes: # 如果当前时间大于缓存时间10分钟则更新
|
||||
eq_rs_change = True
|
||||
update_time = now
|
||||
else:
|
||||
update_time = eq_rs_cache.get('update_time', baseTime)
|
||||
cache.set(f"equipment_{equipId}", {"running_state": last_mrs, "running_state_timex": last_timex, "update_time":update_time}, timeout=None) # 更新缓存
|
||||
if eq_rs_change:
|
||||
ctask_run.delay("apps.em.services.shutdown_or_startup", equipId, last_timex, last_mrs)
|
||||
|
|
Loading…
Reference in New Issue