Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disconnect clients from pool safely #753

Closed
wants to merge 4 commits into from

Commits on Jun 19, 2016

  1. Disconnect clients from pool safely

    This PR tries to solve the issues raised by redis#732 regarding
    the danger of disconnect clients from the `ConnectionPool.disconnect`
    method executed by a Thread different that those ones that are in charge
    of the connections.
    
    Instead of call the `Connection.disconnect` method it uses the syscall
    `shutdown` to leave the socket unusable. Once the connection tries to use
    the socket, even when it is already blocked such us the `PubSub` pattern, it
    gets a `socket.error` exception that will be cactched by the
    `Connection` class to then raise an `ConnectionError` and disconnect the
    socket in a clean and safe way.
    
    The `Client.execute_command` function catches the `ConnectionError` exception
    and tries to connect again and run the command that raised the error.
    Worth mentioning that in the case of the `Sentinel` environment, if some
    changes regarding the Redis pool of servers - perhaps the mater went
    down and a slave was promoted - the next command will be executed using
    an other server.
    pfreixes committed Jun 19, 2016
    Configuration menu
    Copy the full SHA
    92dfcc5 View commit details
    Browse the repository at this point in the history
  2. Removed unused mock module

    pfreixes committed Jun 19, 2016
    Configuration menu
    Copy the full SHA
    f07ed8d View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2016

  1. Configuration menu
    Copy the full SHA
    7eca549 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a7d66d5 View commit details
    Browse the repository at this point in the history