[ZODB-Dev] Ordering before commit hooks

Gary Poster gary at zope.com
Fri Aug 5 07:38:11 EDT 2005


On Aug 5, 2005, at 6:20 AM, Julien Anguenot wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> I would like to order the before commit hooks on a transaction by  
> being
> able to specify an order for a subscriber at registration time. For  
> the
> moment, they are called in the order they've been registred.

I like this idea, and was just idly wishing for it this morning.

> The order argument could be an integer with a default value to 0 added
> to the registration method.

I usually like the word 'priority' for this sort of value, rather  
than 'order'.  To me 'order' implies unique value--i.e., with 'order'  
I am mildly surprised to learn that two entries may have  the same  
order.  I am not surprised that two entries may share a priority.

If negative values are acceptable then a default value of 0 is OK by me.

> We could just insert the subscriber wihin the queue according to this
> order parameter if found *or* sorting the queue according to this
> parameter before flushing the queue and calling the hooks.

I think it would be ideal if before commit hooks with the same  
priority continue to be in the order in which they were added.  There  
are a number of ways to accomplish this and I expect you can choose a  
very reasonable one :-)

Gary


More information about the ZODB-Dev mailing list