← Back to team overview

launchpad-dev team mailing list archive

Re: Why most event subscribers use the block_implicit_flushes() decorator?

 

On 2012-03-20 08:02, Francis J. Lacoste wrote:
My guess is that they are used to work-around some constraints check.

I say if you remove them and the tests pass, leave them out :-)

We've used block_implicit_flushes on several discrete occasions, for several reasons. According to my email archives:

* To prevent database changes from being flushed during GET requests, back when we first had the idea of making GET run read-only.

* To resolve constraint violations during our migration to Storm. Generally we have fixed the order in which we made changes, but of course with lazy flushing there's no inherent guarantee that the ordering won't go bad again.

* To maintain integrity of foreign-key relationships in early versions of Storm, which would sometimes get flush order wrong.

 * To suppress excessive flushing in security policy code.

So yes, get rid of these where possible; but bear in mind that they may be hiding performance problems as well as flush-ordering problems that tests may not expose.


Jeroen


References