Commit 91761c1a authored by Łukasz Nowak's avatar Łukasz Nowak

Build per combination of path/explanation.

In order to minimise amount of non merged documents build each combination of path
and (closest) explanation in one shot and lock this building.

Note: As it is impossible to create AND-ed transaction level lock SimulationMovement_buildVifib
method is "unsafe" to be called in separate transactions.
parent ba62c527
......@@ -61,6 +61,7 @@ kw.update(\n
\n
context.getPortalObject().portal_catalog.searchAndActivate(\n
method_id=\'SimulationMovement_buildVifib\',\n
packet_size=1, # Separate calls to many transactions\n
method_kw={\'tag\': tag},\n
activate_kw={\'tag\': tag},\n
**kw\n
......
......@@ -50,13 +50,23 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>if context.getDelivery() is not None:\n
<value> <string>"""\n
Take care!\n
\n
This method does not lock in same transaction, as it locks on two different documents (and only on those two)\n
"""\n
if context.getDelivery() is not None:\n
# movement build but not indexed, so do nothing\n
return\n
\n
root_applied_rule = context.getRootAppliedRule()\n
\n
context.getCausalityValue(portal_type=\'Business Link\').build(path=\'%s/%%\' % root_applied_rule.getPath(), activate_kw={\'tag\': tag})\n
business_link = context.getCausalityValue(portal_type=\'Business Link\')\n
explanation = context.getImmediateExplanationValue()\n
lock_tag = \'build_in_progress_%s_%s\' % (explanation.getUid(), business_link.getUid())\n
if context.getPortalObject().portal_activities.countMessageWithTag(lock_tag) == 0:\n
business_link.build(explanation=explanation, activate_kw={\'tag\': tag})\n
explanation.activate(activity=\'SQLQueue\', after_tag=tag, tag=lock_tag).getId()\n
</string> </value>
</item>
<item>
......
694
\ No newline at end of file
695
\ No newline at end of file
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