[Zope] ClientDisconnected - how to prevent this from showing up?

Dieter Maurer dieter at handshake.de
Mon May 24 12:38:17 EDT 2004


george donnelly wrote at 2004-5-24 00:05 -0500:
> ...
>>Our solution: send a keep alive message every 20 min.
>>
>
>i see, thanks. the keep ailve messages, are these nat rules, http
>requests? something else?

The are generated like this:

from thread import start_new_thread
from time import sleep
from zLOG import LOG, INFO, PROBLEM, ERROR
from sys import exc_info
from os import environ

from App.config import getConfiguration

KeepPeriod= int(environ.get('ZEO_KEEP_ALIVE')) * 60

Storage = getConfiguration().dbtab.getDatabase('/')._storage

def keepAlive():
    LOG("CustomZODB",INFO,"Keep alive thread started")
    while 1:
        sleep(KeepPeriod)
        if Storage._ready.isSet():
            LOG("CustomZODB",INFO,"Sending keep alive message")
            Storage._lock.acquire()
            try:
                try:
                    Storage._server.get_info()
                    LOG("CustomZODB",INFO,"Sent keep alive message")
                except:
                    LOG("CustomZODB",ERROR,".... failed", error=exc_info())
            finally: Storage._lock.release()
        else:
            LOG("CustomZODB",PROBLEM,"Connection is down")
start_new_thread(keepAlive,())


The code is executed during initialization of one product.

-- 
Dieter



More information about the Zope mailing list