[ZODB-Dev] How to update an object in a multithreading application?

Jim Fulton jim at zope.com
Mon Mar 19 20:49:11 UTC 2012


On Mon, Mar 19, 2012 at 4:36 PM, Marius Gedminas <marius at gedmin.as> wrote:
> On Mon, Mar 19, 2012 at 02:04:34PM -0300, Sebastian Wain wrote:
...
> As Alan said, you need a connection.sync() here.
>
> I believe calling transaction.begin() again at this point would also do
> that (just remember that transaction.begin() implicitly aborts the
> previous transaction, so don't do that if you have uncommitted changes
> you want to keep).

sync should be deprecated. :)

transaction.begin() is better. Both sync and begin abort the existing
transaction.  sync is a holdover from the days when ZEO sometimes
didn't have it's own thread.

Remember that with multi-version concurrency control, you always
see the database as it was at the beginning of the transaction.  If you
want to see updates, you need to start a new transaction.

Jim


-- 
Jim Fulton
http://www.linkedin.com/in/jimfulton


More information about the ZODB-Dev mailing list