[ZODB-Dev] database conflict fail
Alexandre Garel
alex.garel at tarentis.com
Fri Mar 23 08:36:24 UTC 2012
Le 21/03/2012 23:54, Claudiu Saftoiu a écrit :
> Hello ZODB List,
>
> <snip>
>
> key = ...
> print "Acquiring %s lock..." % (key,)
> KEY_LOCKS[key].acquire()
> print "%s lock acquired." % (key,)
> def after_commit_hook(success):
> KEY_LOCKS[key].release()
> print "(after %s commit): Released %s lock" % (('failed',
> 'successful')[success], key)
> transaction.get().addAfterCommitHook(after_commit_hook)
>
Hum, if I understood correctly, lock acquiring is done before any change
are made. So the only thing I would have done here is to have a
transaction.begin() after lock.acquire. So you know the other
transaction is committed and you won't have any conflict in you new
transaction.
Does it helps ?
Alex
--
Alexandre Garel
06 78 33 15 37
More information about the ZODB-Dev
mailing list