[Erp5-dev] Delayed reindex, workflow script and acquisition

jp at nexedi.com jp at nexedi.com
Sat Nov 13 09:18:11 CET 2010


Hi,

In order to progress in a useful manner, I suggest you to do as follows.

1- write unit test which simulates what you describe and shows the problem
2- send it to the list

This is how we did ourselves when we had similar issues (which are normally fixed in recent versions).

Regards,

JPS.


> Hi
> 
> I ran into a tricky issue caused by delayed reindexing and
> fast-clicking users. Here is the scenario:
> 
> - there is a Document, which has some Lines
> - Document is a member of a Category
> - Lines acquire membership of a Category from their parent (Document)
> - he Document belongs to a Workflow
> - upon transition, the Workflow triggers a Script
> - the Script iterates over Lines doing something to which it uses
>   Category
> 
> Now what happens is:
> - a user changes Category on Document and saves it
> - then he executes workflow transition
> 
> The result is that the Script in most cases uses the new value of
> Category, but sometimes it uses the old value. This is because
> acquisition goes through portal catalog. If a users clicks through
> workflow transition fast enough, before the reindexing is complete
> (which is not uncommon), the outcome is confusion: scripts are ok, they
> pass all tests, user did everything right, all data is correct, only
> the goods went to a wrong warehouse.
> 
> Now, the only way I found to prevent it is to make the Script get a
> category explicitly from parent (.getParent().getThisCategory()),
> though it is only a workaround. The question is, where is the real
> problem? I wrote a simple code, using legal techniques and basic API,
> the application passed every test, the result was bad. Therefore, there
> is a flaw in the core which we should nail down and fix.
> 
> Bartek
> _______________________________________________
> Erp5-dev mailing list
> Erp5-dev at erp5.org
> http://mail.nexedi.com/mailman/listinfo/erp5-dev
> 


More information about the Erp5-dev mailing list