Commit fce66140 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Fill cache for pre-calculated news_dict too

    This ensure that when users access the site, the information is likely to be cached already.
parent d3dfa4a3
...@@ -108,12 +108,13 @@ class SlapOSComputeNodeMixin(object): ...@@ -108,12 +108,13 @@ class SlapOSComputeNodeMixin(object):
def _fillComputeNodeInformationCache(self, user): def _fillComputeNodeInformationCache(self, user):
key = '%s_%s' % (self.getReference(), user) key = '%s_%s' % (self.getReference(), user)
refresh_etag = self._calculateRefreshEtag()
try: try:
computer_dict = self._getCacheComputeNodeInformation(user) computer_dict = self._getCacheComputeNodeInformation(user)
self._getCachePlugin().set(key, DEFAULT_CACHE_SCOPE, self._getCachePlugin().set(key, DEFAULT_CACHE_SCOPE,
dict ( dict (
time=time.time(), time=time.time(),
refresh_etag=self._calculateRefreshEtag(), refresh_etag=refresh_etag,
data=computer_dict, data=computer_dict,
# Store the XML while SlapTool Still used # Store the XML while SlapTool Still used
data_xml=self.getPortalObject().portal_slap._getSlapComputeNodeXMLFromDict(computer_dict) data_xml=self.getPortalObject().portal_slap._getSlapComputeNodeXMLFromDict(computer_dict)
...@@ -130,6 +131,10 @@ class SlapOSComputeNodeMixin(object): ...@@ -130,6 +131,10 @@ class SlapOSComputeNodeMixin(object):
# called on site # called on site
pass pass
# Also update cache for News Dict, so it speed up access of this UI.
key = '%s_partition_news' % self.getReference()
self._getCachedComputePartitionNewsDict(key, refresh_etag)
def _calculateRefreshEtag(self): def _calculateRefreshEtag(self):
# check max indexation timestamp # check max indexation timestamp
# it is unlikely to get an empty catalog # it is unlikely to get an empty catalog
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment