erp5_full_text_mroonga_catalog: Inherit priority.
Spawn fulltext indexation activity with the same priority as the top-priority activity part of current activity group. And expose the priority of current activity (top-priority for grouped activities). Ideally, the priority of each spawned activity should be the top-priority of all activities member of this activity group for corresponding document. But there is no obvious way to achieve that through indexation API without increasing complexity significantly.
# This script is called to defer fulltext indexing in a lower priority. | # This script is called to defer fulltext indexing. | ||
METHOD_ID = script.id + 'Activity' | METHOD_ID = script.id + 'Activity' | ||
GROUP_METHOD_ID = context.getPath() + '/' + METHOD_ID | GROUP_METHOD_ID = context.getPath() + '/' + METHOD_ID | ||
activateObject = context.getPortalObject().portal_activities.activateObject | activateObject = context.getPortalObject().portal_activities.activateObject | ||
try: | |||
priority = context.getActivityRuntimeEnvironment().getPriority() | |||
except KeyError: | |||
|
|||
# called outside of an activity, could be an immediate reindexation | |||
# XXX: duplicates default priority for sake of simplicity and speed. | |||
# Strictly, this could also look-up default activate parameters, but on | |||
# which document ? Traversing is expensive. So keep things fast by default. | |||
priority = 1 | |||
for document, root_document_path in zip(getPath, getRootDocumentPath): | for document, root_document_path in zip(getPath, getRootDocumentPath): | ||
getattr( | getattr( | ||
activateObject( | activateObject( | ||
document, | document, | ||
activity='SQLDict', | activity='SQLDict', | ||
priority=4, | priority=priority, | ||
node='same', | node='same', | ||
group_method_id=GROUP_METHOD_ID, | group_method_id=GROUP_METHOD_ID, | ||
serialization_tag='full_text_' + root_document_path, | serialization_tag='full_text_' + root_document_path, | ||
... | ... |