From: garciadeblas Date: Fri, 2 Jun 2017 12:32:47 +0000 (+0200) Subject: Updated vim_thread to have global timers; REFRESH_ACTIVE changed to 1 minute X-Git-Tag: v2.0.2~29 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=b334d445d87c1bd38655f4e285ad928b8546b9a9;p=osm%2FRO.git Updated vim_thread to have global timers; REFRESH_ACTIVE changed to 1 minute Change-Id: I923ba189101184fed6d8148835af579c03f51efa Signed-off-by: garciadeblas --- diff --git a/osm_ro/vim_thread.py b/osm_ro/vim_thread.py index 8a987ac2..67bef44d 100644 --- a/osm_ro/vim_thread.py +++ b/osm_ro/vim_thread.py @@ -46,6 +46,8 @@ def is_task_id(task_id): class vim_thread(threading.Thread): + REFRESH_BUILD = 5 # 5 seconds + REFRESH_ACTIVE = 60 # 1 minute def __init__(self, vimconn, task_lock, name=None, datacenter_name=None, datacenter_tenant_id=None, db=None, db_lock=None, ovim=None): @@ -212,12 +214,12 @@ class vim_thread(threading.Thread): task["vim_info"] = vim_info if task["vim_info"]["status"] == "BUILD": - self._insert_refresh(task, now+5) # 5seconds + self._insert_refresh(task, now + self.REFRESH_BUILD) else: - self._insert_refresh(task, now+300) # 5minutes + self._insert_refresh(task, now + self.REFRESH_ACTIVE) except vimconn.vimconnException as e: self.logger.error("vimconnException Exception when trying to refresh vms " + str(e)) - self._insert_refresh(task, now + 300) # 5minutes + self._insert_refresh(task, now + self.REFRESH_ACTIVE) if net_to_refresh_list: try: @@ -279,12 +281,12 @@ class vim_thread(threading.Thread): task["vim_info"] = vim_info if task["vim_info"]["status"] == "BUILD": - self._insert_refresh(task, now+5) # 5seconds + self._insert_refresh(task, now + self.REFRESH_BUILD) else: - self._insert_refresh(task, now+300) # 5minutes + self._insert_refresh(task, now + self.REFRESH_ACTIVE) except vimconn.vimconnException as e: self.logger.error("vimconnException Exception when trying to refresh nets " + str(e)) - self._insert_refresh(task, now + 300) # 5minutes + self._insert_refresh(task, now + self.REFRESH_ACTIVE) if not items_to_refresh: time.sleep(1)