Discussion:
[Erp5-dev] Forcing to wait reindexing
Guillaume MICHON
2005-06-24 15:39:51 UTC
Permalink
Hi all,

Romain said me Nexedi staff was removing manual immediateReindexObject()
calls to speed up the system.
So I need to find a solution to a problem about this in DeliveryBuilders
(Romain has the same problem).

A DeliveryBuilder manipulates Simulation Movement properties, and can
make them divergent. But the connected Delivery uses the catalog to know
if the Simulation Movement is divergent. And this divergence test is
made in an interaction workflow which is called on the delivery edit()
method.

The problem is the following :
1) The DeliveryBuilder changes Simulation Movement properties
2) edit() is called on the delivery, and the divergence workflow makes a
test, but the Simulation Movement has not been reindex yet, so the
movement.is_divergent SQL column is not up to date.

I see two solutions :
- Add some immediateReindexObject : it is bad.
- Find something to make the divergence workflow wait until the
Simulation Movements are reindexed.

The second solution can be made by using the 'after_method_id' argument
when calling delivery.activate().edit(), but it is not so good I think,
because "immediateReindexObject" is a massively called method in activities.
Have you some ideas ?

Regards,
Guillaume
Yoshinori Okuji
2005-06-24 17:44:54 UTC
Permalink
Post by Guillaume MICHON
The second solution can be made by using the 'after_method_id' argument
when calling delivery.activate().edit(), but it is not so good I think,
because "immediateReindexObject" is a massively called method in
activities. Have you some ideas ?
I don't see what is bad with waiting for immediateReindexObject.

If you really need to ignore immediateReindexObject, you could use ZODB. For
example, get simulation movements related to a given delivery by
portal_catalog, and call isDivergent on each simulation movement. Since a
delivery is related to only zero or one simulation movement, this should not
be too slow. But this does not work if the simulation movement is not indexed
at all yet.

If you are eager to implement an optimal solution, you could extend
CMFActivity. For example, you could add after_path_and_method_id, which would
specify (simulation_movement.getPath(), 'immediateReindexObject').

YO
--
Yoshinori Okuji, Nexedi Research Director
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Free / Open Source ERP Software for small and medium companies
http://www.erp5.org
Storever: OpenBrick, WiFi infrastructure, notebooks and servers
http://www.storever.com
Loading...