IlyaSkriblovsky/txredisapi

Resending of password when reconnect=True

jonathanslenders opened this issue · 3 comments

The connection protocol does not resend the password, when the connection was lost. Further, when the database was changed using select(), it doesn't remember this for after a connection was lost.

We use the following code for setting up a database connection:

model_storage = yield txredisapi.ConnectionPool(
        getattr(settings, 'MODEL_STORAGE_REDIS_HOST', 'localhost'),
        getattr(settings, 'MODEL_STORAGE_REDIS_PORT', 6379),
        None,
        True)

model_password = getattr(settings, 'MODEL_STORAGE_REDIS_PASSWORD', None)
if model_password:
    yield model_storage.auth(model_password)
yield model_storage.select(getattr(settings, 'MODEL_STORAGE_REDIS_DB', 3))

After a connection loss, we don't have the password or dbid anymore.

This is a caveat documented in the readme file. Most of us don't use passwords in redis and even redis docs don't recommend using passwords. Patches are always welcome.

The same problem occurs when we didn't pass a dbid to the connectionpoll, but use select() later on. txredisapi will reconnect on the wrong database. You find the patch in the pull-request.

Cool, thanks!