Commit 46e5b5c3 authored by Rafael Monnerat's avatar Rafael Monnerat

erp5_core: Expand simulation with priority 3

 Move Simulation to priority 3 helps to not block/delay immediateReindex
 on a scenario where everything is expanding. We use priority 3 to match
 what is used in SimulableMixin.updateSimulation and Delivery.localBuild
parent 3ab8e40d
......@@ -41,7 +41,8 @@ from Products.ERP5Type.XMLObject import XMLObject
from erp5.component.document.ImmobilisationDelivery import ImmobilisationDelivery
from erp5.component.mixin.AmountGeneratorMixin import AmountGeneratorMixin
from erp5.component.mixin.CompositionMixin import CompositionMixin
from erp5.component.mixin.SimulableMixin import SimulableMixin
from erp5.component.mixin.SimulableMixin import SimulableMixin, \
SIMULATION_PRIORITY
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod, \
unrestricted_apply
from erp5.component.interface.IMovementCollection import IMovementCollection
......@@ -669,7 +670,7 @@ class Delivery(XMLObject, ImmobilisationDelivery, SimulableMixin,
# XXX: Previous implementation waited for expand activities of related
# documents and even suggested to look at explanation tree,
# instead of causalities. Is it required ?
kw = {'priority': 3}
kw = {'priority': SIMULATION_PRIORITY}
kw.update(activity_kw)
after_tag = kw.pop('after_tag', None)
if isinstance(after_tag, basestring):
......
......@@ -35,6 +35,8 @@ from Products.ERP5Type.Base import Base
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5Type.Errors import SimulationError
SIMULATION_PRIORITY = 3
class SimulableMixin(Base):
security = ClassSecurityInfo()
......@@ -69,7 +71,7 @@ class SimulableMixin(Base):
activity='SQLQueue',
group_method_id='portal_rules/updateSimulation',
tag='build:' + path,
priority=3,
priority=SIMULATION_PRIORITY,
)._updateSimulation(**kw)
del tv[key]
ignore.update(kw)
......@@ -97,7 +99,9 @@ class SimulableMixin(Base):
if applied_rule is None:
applied_rule = self._createRootAppliedRule()
expand_root = applied_rule is not None
activate_kw = {'tag': 'build:'+self.getPath()}
activate_kw = {'tag': 'build:'+self.getPath(),
'priority': SIMULATION_PRIORITY
}
if expand_root:
applied_rule.expand(activate_kw=activate_kw)
else:
......
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