[Zope] Automatically restarting ZPyGreSQLDA connection

Hannu Krosing hannu@trust.ee
Tue, 01 Jun 1999 00:01:58 +0300


Hi,

Is there any way to catch the error from a Zope Database 
Adapter and restart it ?

I'm experiencing what I suspect are timeout problems (sometimes 
a bunch of imapd's drive the load to >10 and make the computer 
really slow). 

The symptom is that at some point I get a traceback from 
_pgmodule instead of nice page.

The only way to fix it after that is going to manage screens and 
shutdown/startup the connection

I would like to catch this exception and do the 
shutdown/startup automatically (and perhaps log that it happened)

Or would the only reasonable place to do such things be inside 
the DA ?

The latter should not be too hard, just try: to send an empty query 
before the real one (con.query("")) and in except: open a new one 
(and log the error if desired)

The overhead should be almost nothing, at least when using domain 
sockets.

---------------
Hannu