Commit 97998f56 authored by Jérome Perrin's avatar Jérome Perrin

core: report progress in ERP5Site_reindexLatestIndexedObjects

Using same approach as ERP5Site_resynchroniseCatalogSince
parent 27a6dce4
Pipeline #37263 failed with stage
in 0 seconds
from erp5.component.module.Log import log
# Reindex objects which indexation_timestamp is at most
# delta seconds before current time (ie, bound inclued).
# Unindex objects which cannot be found.
......@@ -10,7 +11,8 @@ candidate_list = context.ERP5Site_zGetLatestIndexedObjectList(delta=delta)
reindex_count = 0
unindex_count = 0
for candidate in candidate_list:
row_count = len(candidate_list)
for i, candidate in enumerate(candidate_list):
path = candidate['path']
try:
obj = portal.restrictedTraverse(path)
......@@ -23,6 +25,9 @@ for candidate in candidate_list:
else:
obj.reindexObject()
reindex_count += 1
if i % 1000 == 0:
log('processed %i/%i lines' % (i, row_count))
print('%s object reindexed, %s object unindexed' % (reindex_count, unindex_count))
return printed
message = '%s object reindexed, %s object unindexed' % (reindex_count, unindex_count)
log(message)
return message
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