Commit 69f8d5be authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Use transactional data for ensure etags is consistent

   By using getModificationDate, it ensures that the data is set according to the transaction, since catalog can be updated since the transaction started leading to a recent etag using outdated cache from the transaction.
parent ade2551f
...@@ -135,15 +135,17 @@ class SlapOSComputeNodeMixin(object): ...@@ -135,15 +135,17 @@ class SlapOSComputeNodeMixin(object):
# check max indexation timestamp # check max indexation timestamp
# it is unlikely to get an empty catalog # it is unlikely to get an empty catalog
last_indexed_entry = self.getPortalObject().portal_catalog( last_indexed_entry = self.getPortalObject().portal_catalog(
select_list=['indexation_timestamp'], select_list=['indexation_timestamp', 'modification_date'],
portal_type=['Compute Node', 'Compute Partition', portal_type=['Compute Node', 'Compute Partition',
'Software Instance', 'Slave Instance', 'Software Instance', 'Slave Instance',
'Software Installation'], 'Software Installation'],
sort_on=[('indexation_timestamp', 'DESC')], sort_on=[('indexation_timestamp', 'DESC')],
limit=1, limit=1,
)[0] )[0]
return '%s_%s' % (last_indexed_entry.uid, return '%s_%s_%s_%s' % (last_indexed_entry.uid,
last_indexed_entry.indexation_timestamp) last_indexed_entry.indexation_timestamp,
last_indexed_entry.modification_date,
last_indexed_entry.getModificationDate())
def _isTestRun(self): def _isTestRun(self):
if self.REQUEST.get('disable_isTestRun', False): if self.REQUEST.get('disable_isTestRun', False):
......
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