IlyaSkriblovsky / txredisapi

non-blocking redis client for python twisted
Apache License 2.0
235 stars 91 forks source link

lazyConnection stops reconnecting #146

Open janisare opened 3 years ago

janisare commented 3 years ago

if dbid is provided, lazyConnection will loseConnection and stop reconnecting on redis server restart etc. Connection should not be closed here:

    if self.dbid is not None:
        try:
            response = yield self.select(self.dbid)
            if isinstance(response, ResponseError):
                raise response
        except Exception as e:
            self.factory.continueTrying = False
            self.transport.loseConnection()

            msg = "Redis error: could not set dbid=%s: %s" % \
                  (self.dbid, str(e))
            self.factory.connectionError(msg)
            if self.factory.isLazy:
                log.msg(msg)
            defer.returnValue(None)