X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_lcm%2Flcm_utils.py;h=b4e6887d4e14518d3ad476d326d1b1877fa1c526;hb=refs%2Fchanges%2F21%2F8221%2F4;hp=a6ce5bddde57c219737e079a7ae77b8f637e2765;hpb=9f9c6f2e8b8e978deaa4fb6e1482c0656ce4bd45;p=osm%2FLCM.git diff --git a/osm_lcm/lcm_utils.py b/osm_lcm/lcm_utils.py index a6ce5bd..b4e6887 100644 --- a/osm_lcm/lcm_utils.py +++ b/osm_lcm/lcm_utils.py @@ -18,6 +18,7 @@ import asyncio from collections import OrderedDict +from time import time # from osm_common.dbbase import DbException __author__ = "Alfonso Tierno" @@ -71,6 +72,8 @@ class LcmBase: """ if not _desc: return + now = time() + _desc["_admin.modified"] = now self.db.set_one(item, {"_id": _id}, _desc) _desc.clear() # except DbException as e: @@ -252,12 +255,15 @@ class TaskRegistry(LcmBase): else: # NS/NSI if self._is_service_type_HA(topic): + now = time() starttime_this_op = db_lcmop.get("startTime") instance_id_label = self.topic2instid_dict.get(topic) instance_id = db_lcmop.get(instance_id_label) _filter = {instance_id_label: instance_id, 'operationState': 'PROCESSING', - 'startTime.lt': starttime_this_op} + 'startTime.lt': starttime_this_op, + "_admin.modified.gt": now - 2*3600, # ignore if tow hours of inactivity + } # VIM/WIM/SDN/K8scluster elif self._is_account_type_HA(topic): _, op_index = self._get_account_and_op_HA(op_id)