summaryrefslogtreecommitdiffstats
path: root/share/starlingx_base/registration/registration.py
diff options
context:
space:
mode:
authorXiaohua Zhang <xiaohua.zhang@windriver.com>2019-04-04 08:08:35 +0000
committerXiaohua Zhang <xiaohua.zhang@windriver.com>2019-04-04 08:34:07 +0000
commit54700feaf9055b2192612e4c3958c6ac5bbd6a56 (patch)
tree788f1e23b372c57bc3942e639c7562458c4119a4 /share/starlingx_base/registration/registration.py
parent0491327f8dcd808402669c3d8f32a5a0f879db45 (diff)
Fix thread helper bug
the uwsgi disable threads by default. Enable it with additonal option. The post and get API request might routed to different uwsgi process, Leverage memcached to sync backlog items between uwsgi process Change-Id: Iaac6b66061f2c396cd24825ab020f0a937dfb505 Issue-ID: MULTICLOUD-561 Signed-off-by: Xiaohua Zhang <xiaohua.zhang@windriver.com>
Diffstat (limited to 'share/starlingx_base/registration/registration.py')
-rw-r--r--share/starlingx_base/registration/registration.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/share/starlingx_base/registration/registration.py b/share/starlingx_base/registration/registration.py
index 9d1846d7..21ab1948 100644
--- a/share/starlingx_base/registration/registration.py
+++ b/share/starlingx_base/registration/registration.py
@@ -32,13 +32,14 @@ from django.core.cache import cache
logger = logging.getLogger(__name__)
# global var: Audition thread
-gAZCapAuditThread = helper.MultiCloudThreadHelper()
+gAZCapAuditThread = helper.MultiCloudThreadHelper("azcap")
# DEBUG=True
# APIv0 handler upgrading: leverage APIv1 handler
class APIv0Registry(newton_registration.Registry):
def __init__(self):
+ # logger.error(traceback.format_exc())
self.register_helper = RegistryHelper(settings.MULTICLOUD_PREFIX, settings.AAI_BASE_URL)
super(APIv0Registry, self).__init__()
# self._logger = logger
@@ -52,10 +53,10 @@ class APIv0Registry(newton_registration.Registry):
settings.AAI_BASE_URL
)
backlog_item = {
- "id": vimid,
- "worker": worker_self.azcap_audit,
- "payload": (worker_self, vimid),
- "repeat": 5*1000000, # repeat every 5 seconds
+ "id": vimid,
+ "worker": worker_self.azcap_audit,
+ "payload": (worker_self, vimid),
+ "repeat": 10*1000000, # repeat every 10 seconds
}
gAZCapAuditThread.add(backlog_item)
if 0 == gAZCapAuditThread.state():
@@ -127,6 +128,7 @@ class RegistryHelper(newton_registration.RegistryHelper):
Helper code to discover and register a cloud region's resource
'''
def __init__(self, multicloud_prefix, aai_base_url):
+ # logger.error(traceback.format_exc())
super(RegistryHelper, self).__init__(multicloud_prefix, aai_base_url)
# self._logger = logger