[ZODB-Dev] ZEO, get_transaction() & threads

John E. Barham jbarham@octopuswireless.com
Tue, 24 Jul 2001 18:31:55 -0700


Hi all,

We're developing a Web-based order-entry application w/ Palm "Pilot"
connectivity.  Last week I rewrote the server from C++/MSDE/Apache to
Python/ZEO/Medusa.  Works like a charm!  Thanks to the crew from DigiCool
(or is it Zope.com now?) for the magical ZODB/ZEO combo and amk for his
excellent documentation and standalone distro.

Anyway, a couple of issues:  I'm running the ZEO server and clients on
Win2k.  If I do get_transaction().commit() from one client the other client
doesn't see the changes to the DB unless it restarts.  What am I doing
wrong?  Do I need to close and re-open the connection to see changes that
other clients have made?

Also our Web server (written on top of Medusa's http_server much like Zope)
is multi-threaded to handle long-lived CGI scripts sanely.  (Basically I
modified Medusa's thread_handler demo which spins off a pool of worker
threads on startup.)  One problem w/ using threads is knowing which DB
connection the thread should be dealing w/.  From what I can make of the
get_transaction() source in Transaction.py, get_transaction() maps thread
ids to Transaction objects (so get_transaction() is really a thread-specific
vs. a "regular" global function?).  Should I take the same approach for my
worker threads, creating a global dictionary mapping thread ids to DB
connections?  The reason I (think I) need this is that my DB objects need to
refer to each other to do integrity checking and should presumably only be
querying objects that live in the same connection as themselves.

Thanks in advance.  Apologies if this has already been answered; I trawled
through the archive as best I could...

	John

---
John E. Barham
Senior Software Developer
jbarham@octopuswireless.com
www.octopuswireless.com

Phone: (604) 434-1321
Fax: (604) 430-1419

Octopus Wireless Inc.
5317 Lane Street
Burnaby, BC
V5H 2H4