[Zope-dev] Re: When should one call Connection.sync?

Syver Enstad syver at inout.no
Wed Apr 21 12:03:23 EDT 2004


Syver Enstad <syver at inout.no> writes:

> I am using ZODB 3.2 in a twisted based web application. I have read
> that I need to call sync to keep the connection up to date. When
> exactly should I call sync? Are there any drawbacks with calling it
> immediately after getting a connection, like this:
> 
> # for each http request.
> connection = db.open() # (a DB instance)
> connection.setLocalTransaction()
> connection.sync()
> 
> # start using the ZODB here.
> 
> # if something needs to be committed
> connection.getTransaction().commit()

I have done some experiments with this scheme and I find that
everything gets unloaded when do a connection.close() or
connection.sync() so that performance takes quite a hit.






More information about the Zope-Dev mailing list