[ZODB-Dev] [patch] 2 tiny patches for zeo clients and 1 for zeo storage server

Joseph Wayne Norton norton@alum.mit.edu
Tue, 23 Oct 2001 01:08:52 +0900


Hello.  I made a couple of patches and felt they might be of interest
to others and or inclusion in to the main branch.

1) I realized that I one cannot disable the persistent cache option for
zeo clients that are being used for mounted storage (using external
mount or something similar) . The ZEO_CLIENT environment variable will
typically be set for the main zope and thus the mounted storage cannot
turn on or turn off the persistent cache if it wishes.

So, I made a small change to allow None to be passed to indicate no
persistent cache.

2) I also like the min and max poll feature but it causes excessive
logging to be performed so I added a variable min_disconnect_log to
minimize the logging overhead.

3) The accept failure stderr message doesn't include the reason for
the failure.

Index: ZEO/ClientStorage.py
===================================================================
RCS file: /cvs-repository/ZEO/ZEO/ClientStorage.py,v
retrieving revision 1.33.2.1
diff -r1.33.2.1 ClientStorage.py
122c122
<                  min_disconnect_poll=5, max_disconnect_poll=300,
---
>                  min_disconnect_poll=5, max_disconnect_poll=300, min_disconnect_log=300,
126c126,127
<         client=client or os.environ.get('ZEO_CLIENT','')
---
>         if client is not None:
>             client=client or os.environ.get('ZEO_CLIENT','')
132c133
< 
---
>         
139c140,141
<                                  tmax=max_disconnect_poll)
---
>                                  tmax=max_disconnect_poll,
>                                  tmin_log=min_disconnect_log)
Index: ZEO/StorageServer.py
===================================================================
RCS file: /cvs-repository/ZEO/ZEO/StorageServer.py,v
retrieving revision 1.28.2.5
diff -r1.28.2.5 StorageServer.py
197,198c197,198
<         except socket.error:
<             sys.stderr.write('warning: accept failed\n')
---
>         except socket.error, why:
>             sys.stderr.write('warning: accept failed - %s\n' % why)
Index: ZEO/zrpc.py
===================================================================
RCS file: /cvs-repository/ZEO/ZEO/zrpc.py,v
retrieving revision 1.18.2.4
diff -r1.18.2.4 zrpc.py
118c118
<     def __init__(self, connection, outOfBand=None, tmin=5, tmax=300, debug=0):
---
>     def __init__(self, connection, outOfBand=None, tmin=5, tmax=300, tmin_log=300, debug=0):
121c121,122
<         self._tmin, self._tmax = tmin, tmax
---
>         self._tmin, self._tmax, = tmin, tmax
>         self._tmin_log, self._last_tmin_log = tmin_log, 0
140,141c141,146
<             if log_type: LOG(log_type, INFO,
<                              'Trying to connect to server: %s' % `connection`)
---
>             if log_type:
>                 now = time.time()
>                 if (now - self._last_tmin_log) > self._tmin_log:
>                     self._last_tmin_log = now
>                     LOG(log_type, INFO,
>                         'Trying to connect to server: %s' % `connection`)