durusmail: quixote-users: scgi and zodb
scgi and zodb
2004-09-08
2004-09-08
scgi and zodb
Thomas Guettler
2004-09-10
Am Mittwoch, 8. September 2004 16:54 schrieb Neil Schemenauer:
> On Wed, Sep 08, 2004 at 10:46:40AM +0200, Thomas Guettler wrote:
> > Since scgi uses fork to create new processes, every
> > child gets the same connection to zodb. I use
> > ZEO with a socket file.
>
> The connection needs to be made after the fork.  The start-scgi.py
> script in the Dulcinea package does that.

Hi Neil and others,

in start-scgi the fork lets the server run in the background.
The conntection to the database is done before a browser
requests a page.

I put debug messages into the SCGIHandler and the
Publisher of quixote. Both get created on scgi startup.

The real connection needs to be done
after the fork which creates the worker process.

I looked at the source of DulcineaPublisher, but I couldn't
see the creation of a new connection for each request
(start_request or try_publish methods).

I tried to get toboso running to see where you create
a new connection, but I failed in create_db.py

===> ./bin/create_db.py
debug from me: module: 

Traceback (most recent call last):
  File "./bin/create_db.py", line 50, in ?
    init_database(db)
  File "./bin/create_db.py", line 22, in init_database
    db.init_root(name, modname, klassname)
  File
"/localhome/modarch/python/lib/python2.3/site-packages/dulcinea/database.py",
line 266, in init_root
    klass = getattr(module, klassname)
AttributeError: 'module' object has no attribute
'dulcinea.user_database.ContactDatabase'

My question is solved: I will create a new connection in start_request,
but I am curios how you do it in dulcinea.

I will be back on monday, have a nice weekend,

 Thomas

reply