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

_______________________________________________
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to