[ZODB-Dev] Quick ZODB connection synch question
Nicholas Henke
henken at seas.upenn.edu
Mon Sep 29 10:15:00 EDT 2003
On Mon, 2003-09-29 at 10:01, Shane Hathaway wrote:
>
> Let's say you have connection A and connection B. (It doesn't matter
> whether A and B are in the same process or on different continents.)
> Imagine you do the following with connection A:
>
> >>> A.root()["Test"] = 1
> >>> get_transaction().commit()
>
> Connection B will not see this change until it commits a transaction or
> calls sync(). Here is what you should expect:
>
> >>> B.root()["Test"]
> KeyError: 'Test'
> >>> B.sync()
> >>> B.root()["Test"]
> 1
>
> Furthermore, you should not expect B to be updated implicitly at
> transaction boundaries unless some object in B actually got changed.
>
> Now, Zope uses a little trick that avoids the need to calling sync(): it
> opens a database connection for every HTTP request. The only pitfall of
> this trick is that if you don't also run an asyncore loop with ZEO, the
> database will not receive ZEO invalidations. You'll only fall into this
> if you're using ZEO, you're not using sync(), and you're not using an
> asyncore loop.
Thanks Shane~~
I think I understand that -- but what I was asking for was a code
example setting up the use of the asyncore mainloop, or at least have
that example put more concretely into the 'Introduction to ZODB & ZEO'
guide linked from the main page for ZODB. It would help those new to
using ZEO, as the current ayncore info is just a small blurb kinda
hidden in the documentation.
Sorry for being such a pain~
Nic
--
Nicholas Henke
Penguin Herder & Linux Cluster System Programmer
Liniac Project - Univ. of Pennsylvania
More information about the ZODB-Dev
mailing list