[Jens Vagelpohl]
>>> Does't the *already included* zeoup.py do exactly what you are trying
>>> to do? See the bin directory of your zope home.

[Sidnei da Silva]
>> Unfortunately no. It uses ClientStorage, which goes through the 1000's
>> of lines of the connection dance using connect threads and large
>> timeouts. Effectively, ClientStorage will retry a connection 'forever'.
>> I just want to see if the port is listening and it smells like ZEO with
>> the minimal reasonable timeout.

[Chris Withers]
> Sounds like zeoup.py doesn't do what it should, which is what you're
> after. How about repairing zeoup.py rather than rolling yet another
> not-really-needed script? ;-)

Sidnei, have you tried opening a ClientStorage with wait=True and
wait_timeout=x, where x is "a small float"?  The docs are unclear, and I
don't know whether it works as intended, but the intent appears to be that
when wait=True, wait_timeout gives the maximum number of seconds you're
willing to wait for a connection to succeed.

If it does work, then I expect that exploiting it is what this comment in
zeoup.py had in mind:

        # TODO:  should do retries w/ exponential backoff.

I can't follow this code, alas, and got stalled in a project trying to
simplify it.  I did note at once that:

    def _wait(self, timeout=None):

does a


no matter how small `timeout` may be, so I _expect_ it's futile to pass a
timeout value smaller than 30.

    def _wait_sync(self, deadline=None):

also does a


which _appears_ to be another hard-coded barrier to using a
smaller-than-30-seconds timeout effectively.

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to