summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2019-05-06 12:03:51 +0000
committerBin Yang <bin.yang@windriver.com>2019-05-06 12:03:51 +0000
commit2f6118e53e22a8abbfc1245295ed167519c2811e (patch)
tree43a37f8533cde076bc9ab8fcc316d908304224dd
parent44dd8f2c00ee8a6ec5157bc24af6ae0bcb75d9dd (diff)
Fix the intermittent error to get Infra_workload
Fix the operation of update backlog to make sure at least one copy of backlog item exists Change-Id: I4b1e6f3ce330c1d8f37a46c547f18e1ef95e67af Issue-ID: MULTICLOUD-603 Signed-off-by: Bin Yang <bin.yang@windriver.com>
-rw-r--r--share/common/msapi/helper.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/share/common/msapi/helper.py b/share/common/msapi/helper.py
index 69b91953..de8852c8 100644
--- a/share/common/msapi/helper.py
+++ b/share/common/msapi/helper.py
@@ -281,6 +281,15 @@ class MultiCloudThreadHelper(object):
return False
+ def expire(self, backlog_id):
+ # important: the order of operation should make sure
+ # there is at least 1 copy of backlog item in either backlog or expired backlog
+ # self.lock.acquire()
+ backlogitem = self.backlog.get(backlog_id, None)
+ self.owner.expired_backlog[backlog_id] = backlogitem
+ self.backlog.pop(backlog_id, None)
+ # self.lock.release()
+
def remove(self, backlog_id):
# self.lock.acquire()
self.backlog.pop(backlog_id, None)
@@ -345,7 +354,7 @@ class MultiCloudThreadHelper(object):
"status": item["status"]
}
if item.get("repeat", 0) == 0:
- self.owner.remove(backlog_id)
+ self.owner.expire(backlog_id)
# keep only the id and status
self.owner.expired_backlog[backlog_id] = {"status": item["status"]}