Commit 71560fc5 authored by Łukasz Nowak's avatar Łukasz Nowak

Reactivate the internal cache.

parent 0295e3d4
master 20240521_variousimprovements 20240704 20240827 20240905_fixup 20240913 20240914 20240925 20240930 20241004 20241008 20241021 20241106 20241107 20241114 20241127 20241209 20241230 20250108 20250117_beforesquash_newapi 20250121 alain-message allocation_consistency_instance_node amarisoft change_subscription_price cleanup cliff-cleanup crm_fix customprice cygwin-link-local event_attachment feat/cmmi_cache feat/openorderbasedsecurity feat/statuscleanup feat/testcase feature/cgroups feature/format-crumbled feature/manager-cpuset feature/option_create_tun feature/tun-cgroup-cleanup fix/slapos-ansible format_loop hosting_daily_invoice hotfix/proxy-root-instance localwip manager_update_parameter master-dev message-box new-api-master-client panel_computer_guid panel_filter_action_dict py3_fixup register_partition_info_only_if_needed regulatisation_request_for_organisation seb shop_rapid_space slap_tool_less_sql_query slapos-override-env slapproxy-connection-parameter speed_improvement splitopenorder subscription_change_request tomo_fix_slapos_format tomo_fix_slapos_node_boot tomo_listbox_update trigger_allocation_alarm upgrade_decision_event usage_report wip wip20210701 wip20210819 wip20220131 1.4.27 1.4.26 1.4.25 1.4.24 1.4.23 1.4.22 1.4.21 1.4.20 1.4.19 1.4.17 1.4.16 1.4.15 1.4.14 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.18 1.3.17 1.3.16 1.3.15 1.3.14 1.3.13 1.3.12 1.3.11 1.3.10 1.3.9 1.3.8 1.3.7 1.3.6.3 1.3.6.2 1.3.6.1 1.3.6 1.3.5 1.3.4 1.3.3 1.3.2 1.3.1 1.3.0 1.2.4.1 1.2.4 1.2.3.1 1.2.3 1.2.2 1.2.1 1.2.0 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0 1.0.0rc6 1.0.0rc5 1.0.0rc4 1.0.0rc3 1.0.0-rc1 0.35.1 0.34 0.33.1 0.33 0.32.3 0.32.2 master-20180917
No related merge requests found
......@@ -36,7 +36,7 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type import Permissions
#from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE
from lxml import etree
import time
......@@ -208,25 +208,25 @@ class SlapTool(BaseTool):
slap_computer._computer_partition_list = []
if user_type in ('Computer', 'Person'):
# if not self._isTestRun():
# cache_plugin = self._getCachePlugin()
# try:
# entry = cache_plugin.get(user, DEFAULT_CACHE_SCOPE)
# except KeyError:
# entry = None
# if entry is not None and type(entry.getValue()) == type({}):
# result = entry.getValue()['data']
# if time.time() - entry.getValue()['time'] > 60 * 1:
# # entry was stored 1 minutes ago, ask for recalculation
# self._activateFillComputerInformationCache(computer_id, user, full)
# return result
# else:
# self._activateFillComputerInformationCache(computer_id, user, full)
# self.REQUEST.response.setStatus(503)
# return self.REQUEST.response
# else:
# return self._getCacheComputerInformation(computer_id, user, full)
return self._getCacheComputerInformation(computer_id, user, full)
if not self._isTestRun():
cache_plugin = self._getCachePlugin()
try:
entry = cache_plugin.get(user, DEFAULT_CACHE_SCOPE)
except KeyError:
entry = None
if entry is not None and type(entry.getValue()) == type({}):
result = entry.getValue()['data']
if time.time() - entry.getValue()['time'] > 60 * 1:
# entry was stored 1 minutes ago, ask for recalculation
self._activateFillComputerInformationCache(computer_id, user, full)
return result
else:
self._activateFillComputerInformationCache(computer_id, user, full)
self.REQUEST.response.setStatus(503)
return self.REQUEST.response
else:
return self._getCacheComputerInformation(computer_id, user, full)
# return self._getCacheComputerInformation(computer_id, user, full)
else:
slap_computer._software_release_list = []
for computer_partition in self.getPortalObject().portal_catalog(
......@@ -248,14 +248,14 @@ class SlapTool(BaseTool):
"""
user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName()
self._logAccess(user, user, '#access %s' % computer_id)
# if not self._isTestRun():
# result = CachingMethod(self._getComputerInformation,
# id='_getComputerInformation',
# cache_factory='slap_cache_factory')(
# computer_id, user, False)
# else:
# result = self._getComputerInformation(computer_id, user, False)
result = self._getComputerInformation(computer_id, user, False)
if not self._isTestRun():
result = CachingMethod(self._getComputerInformation,
id='_getComputerInformation',
cache_factory='slap_cache_factory')(
computer_id, user, False)
else:
result = self._getComputerInformation(computer_id, user, False)
# result = self._getComputerInformation(computer_id, user, False)
# Keep in cache server for 1 year
self.REQUEST.response.setStatus(200)
......@@ -277,14 +277,14 @@ class SlapTool(BaseTool):
"""
user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName()
self._logAccess(user, user, '#access %s' % computer_id)
# if not self._isTestRun():
# return CachingMethod(self._getComputerInformation,
# id='_getFullComputerInformation',
# cache_factory='slap_cache_factory')(
# computer_id, user, True)
# else:
# return self._getComputerInformation(computer_id, user, True)
result = self._getComputerInformation(computer_id, user, True)
if not self._isTestRun():
return CachingMethod(self._getComputerInformation,
id='_getFullComputerInformation',
cache_factory='slap_cache_factory')(
computer_id, user, True)
else:
return self._getComputerInformation(computer_id, user, True)
# result = self._getComputerInformation(computer_id, user, True)
# Keep in cache server for 1 year
self.REQUEST.response.setStatus(200)
......
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